Here the authors show that the aryl hydrocarbon receptor (AHR) mediates NEC pathogenesis via effects on TLR4, and that supplementing the diet with AHR ligands during pregnancy or postnatally prevents NEC. This evidence concerns the gene AHR and necrotizing enterocolitis.