Consumption of human breast milk (HBM) attenuates the incidence of necrotizing enterocolitis (NEC), which remains a leading and intractable cause of mortality in preterm infants. Here, we report that this diminution correlates with alterations in the gut microbiota, particularly enrichment of Propionibacterium species. Transfaunation of microbiota from HBM-fed preterm infants or a newly identified and cultured Propionibacterium strain, P. UF1, to germfree mice conferred protection against pathogen infection and correlated with profound increases in intestinal Th17 cells. The induction of Th17 cells was dependent on bacterial dihydrolipoamide acetyltransferase (DlaT), a major protein expressed on the P. UF1 surface layer (S-layer). Binding of P. UF1 to its cognate receptor, SIGNR1, on dendritic cells resulted in the regulation of intestinal phagocytes. Importantly, transfer of P. UF1 profoundly mitigated induced NEC-like injury in neonatal mice. Together, these results mechanistically elucidate the protective effects of HBM and P. UF1-induced immunoregulation, which safeguard against proinflammatory diseases, including NEC.