Microbiota and feeding modes influence the susceptibility of premature newborns to necrotizing enterocolitis (NEC) through mechanisms that remain unknown. Here, we show that microbiota colonization facilitated by breastmilk feeding promotes NOD-like receptor family CARD domain containing 5 (Nlrc5) gene expression in mouse intestinal epithelial cells (IECs). Notably, inducible knockout of the Nlrc5 gene in IECs predisposes neonatal mice to NEC-like injury in the small intestine upon viral inflammation in an NK1.1+ cell-dependent manner. By contrast, formula feeding enhances neonatal gut colonization with environment-derived tilivalline-producing Klebsiella spp. Remarkably, tilivalline disrupts microbiota-activated STAT1 signaling that controls Nlrc5 gene expression in IECs through a PPAR-γ-mediated mechanism. Consequently, this dysregulation hinders the resistance of neonatal intestinal epithelium to self-NK1.1+ cell cytotoxicity upon virus infection/colonization, promoting NEC development. Together, we discover the underappreciated role of intestinal microbiota colonization in shaping a disease tolerance program to viral inflammation and elucidate the mechanisms impacting NEC development in neonates.