Persistent apical periodontitis is a critical challenge for endodontists. Developing root canal filling materials with continuous antibacterial effects and tightly sealed root canals are essential strategies to avoid the failure of root canal therapy and prevent persistent apical periodontitis. We modified the EndoREZ root canal sealer with the antibacterial material dimethylaminododecyl methacrylate (DMADDM) and magnetic nanoparticles (MNPs). The mechanical properties of the modified root canal sealer were tested. The biocompatibility of this sealer was verified in vitro and in vivo. Multispecies biofilms were constructed to assess the antibacterial effects of the modified root canal sealer. We applied magnetic fields and examined the extent of root canal sealer penetration in vitro and in vivo. The results showed that EndoREZ sealer containing 2.5% DMADDM and 1% MNP had biological safety and apical sealing ability. In addition, the modified sealer could increase the sealer penetration range and exert significant antibacterial effects on multispecies biofilms under an external magnetic field. According to the in vivo study, the apices of the root canals with the sealer containing 2.5% DMADDM and 1% MNP showed no significant resorption and exhibited only a slight increase in the periodontal ligament space, with a good inhibitory effect on persistent apical periodontitis.