Necrotizing enterocolitis (NEC) is a life-threatening disease that occurs in premature infants. The aim of the present study was to investigate the effects of berberine, an isoquinoline alkaloid mainly used to treat digestive diseases, in a rat model of NEC. NEC models were established in newborn rats via inhalation of N 2 for 90 sec every 4 h and oral administration of 4 mg/kg/day lipopolysaccharides on days 0 and 1. Berberine was administered via oral gavage. In the NEC model group, Toll-like receptor (TLR)4, nuclear factor NF-κB (NF-κB), inducible nitric oxide synthase (iNOS), tumor necrosis factor (TNF)-α, interleukin (IL)-6 and IL-10 were upregulated. Symptoms of NEC in the berberine intervention group were significantly relieved, with a clear reduction in the incidence of NEC compared with the NEC group. TLR4, NF-κB, iNOS, TNF-α, IL-6 and IL-10 expression was decreased following berberine intervention. Furthermore, the expression of mucin-2 (MUC2) and RNA polymerase σ factor SigA (SIgA) were decreased in the NEC model group and increased following berberine intervention, when compared with the untreated group. It was also demonstrated that the incidence of NEC was reduced following berberine administration, possibly owing to changes in the inflammatory responses. The results of the current study support a potential therapeutic role of berberine for the treatment of NEC.