In the nitrogen-fixing symbiosis between legume hosts and rhizobia, the bacteria are engulfed by a plant cell membrane to become intracellular organelles. In the model legume Medicago truncatula, internalization and differentiation of Sinorhizobium (also known as Ensifer) meliloti is a prerequisite for nitrogen fixation. The host mechanisms that ensure the long-term survival of differentiating intracellular bacteria (bacteroids) in this unusual association are unclear. The M. truncatula defective nitrogen fixation4 (dnf4) mutant is unable to form a productive symbiosis, even though late symbiotic marker genes are expressed in mutant nodules. We discovered that in the dnf4 mutant, bacteroids can apparently differentiate, but they fail to persist within host cells in the process. We found that the DNF4 gene encodes NCR211, a member of the family of nodule-specific cysteine-rich (NCR) peptides. The phenotype of dnf4 suggests that NCR211 acts to promote the intracellular survival of differentiating bacteroids. The greatest expression of DNF4 was observed in the nodule interzone II-III, where bacteroids undergo differentiation. A translational fusion of DNF4 with GFP localizes to the peribacteroid space, and synthetic NCR211 prevents free-living S. meliloti from forming colonies, in contrast to mock controls, suggesting that DNF4 may interact with bacteroids directly or indirectly for its function. Our findings indicate that a successful symbiosis requires host effectors that not only induce bacterial differentiation, but also that maintain intracellular bacteroids during the host-symbiont interaction. The discovery of NCR211 peptides that maintain bacterial survival inside host cells has important implications for improving legume crops.nitrogen-fixing symbiosis | Sinorhizobium meliloti | Medicago truncatula | legume | NCR antimicrobial peptides