A magnetic anastomosis device is provided for forming an anastomosis between two bodily walls. The device includes a first magnet assembly and a second magnet assembly configured to be magnetically coupled to compress the two bodily walls therebetween to form the anastomosis. The first magnet assembly includes a first magnet and a second magnet disposed within a first jacket and the second magnet assembly includes a third magnet and a fourth magnet disposed within a second jacket.