With considerable morbidity and mortality, bron-chopulmonary dysplasia (BPD) is a focus of attention in neonatology. Hyperoxia-induced lung injury has long been used as a model of BPD. Among all the signaling pathways involved, Toll-like receptor 4 (TLR4) has been demonstrated to play an important role, and is known to be regulated by vitamin D. This study aimed at elucidating the effect of vitamin D on hyperoxia-induced lung injury and the role of TLR4 in the process. Vitamin D was administered to hyperoxia-treated neonatal rats to investigate changes in the morphology of lungs and expression of pro-inflammatory cytokines, apoptotic proteins and TLR4. Vitamin D attenuated hyperoxia-induced lung injury by protecting the integrity of the lung structure, decreasing extracellular matrix deposition and inhibiting inflammation. The upregulation of TLR4 by hyperoxia was ameliorated by vitamin D and apoptosis was reduced. Vitamin D administration antagonized the activation of TLR4 and therefore alleviated inflammation, reduced apoptosis and preserved lung structure.