The nature and role of the intestinal leukocytes in necrotizing enterocolitis (NEC), a severe disease affecting premature infants, remain unknown. We now show that the intestine in mouse and human NEC is rich in lymphocytes that are required for NEC development, as recombination activating gene 1-deficient (Rag1-/-) mice were protected from NEC and transfer of intestinal lymphocytes from NEC mice into naive mice induced intestinal inflammation. The intestinal expression of the lipopolysaccharide receptor TLR4, which is higher in the premature compared with full-term human and mouse intestine, is required for lymphocyte influx through TLR4-mediated upregulation of CCR9/CCL25 signaling. TLR4 also mediates a STAT3-dependent polarization toward increased proinflammatory CD3+CD4+IL-17+ and reduced tolerogenic Foxp3+ Treg lymphocytes (Tregs). Th17 lymphocytes were required for NEC development, as inhibition of STAT3 or IL-17 receptor signaling attenuated NEC in mice, while IL-17 release impaired enterocyte tight junctions, increased enterocyte apoptosis, and reduced enterocyte proliferation, leading to NEC. Importantly, TLR4-dependent Th17 polarization could be reversed by the enteral administration of retinoic acid, which induced Tregs and decreased NEC severity. These findings identify an important role for proinflammatory lymphocytes in NEC development via intestinal epithelial TLR4 that could be reversed through dietary modification.