Accumulating evidence has linked dyslipidemia during pregnancy to the risk of delivering infants born either large for gestational age (LGA) or small for gestational age (SGA). However, the effects of the vitamin D status on these relationships require further investigation. This study investigated whether the relationship between lipid profiles and the risk of LGA or SGA was influenced by vitamin D levels during the second trimester. Maternal lipid profile levels, including total cholesterol (TC), triglyceride (TG), low-density lipoprotein cholesterol (LDL-C), high-density lipoprotein cholesterol (HDL-C), and vitamin D levels, were measured in a cohort of 6,499 pregnant women during the second trimester. Multivariate regression models and subgroup analyses were employed to evaluate the potential associations between maternal lipid profiles, vitamin D levels, and the risk of LGA or SGA. The prevalence of SGA infants was 9.8% (n=635), whereas that of LGA infants was 6.9% (n=447). Maternal TG levels were found to be positively associated with the risk of LGA (odds ratio [OR] = 1.41, 95% confidence interval [CI]:1.17-1.70), whereas a negative association was observed between maternal TG, TC, LDL-C levels, and risk of SGA. Additionally, mothers with higher HDL-C levels were less likely to give birth to an LGA infant (OR=0.58, 95% CI:0.39-0.85). Importantly, associations between TG, TC, LDL-c, and SGA as well as between TG and LGA were primarily observed among pregnant women with insufficient vitamin D levels. As for HDL-C, the risk of LGA was lower in mothers with sufficient vitamin D (OR = 0.42, 95% CI:0.18-0.98) compared to those with insufficient vitamin D (OR = 0.65, 95% CI:0.42-0.99). Vitamin D status during the second trimester exerts a modifying effect on the association between lipid profiles and the risk of LGA and SGA infants.