Serum vitamin D is associated with hyperuricemia. However, previous studies have been controversial, with limited focus on children and adolescents. This study aimed to examine the cross-sectional and longitudinal associations between serum vitamin D and serum uric acid (SUA) levels in children and adolescents. The cross-sectional survey comprised 4777 participants aged 6 to 18 years, while the longitudinal survey involved 1641 participants aged 6 to 12 years, all derived from an ongoing cohort study in Shenzhen, China. Restricted cubic splines were used to visualize the dose-response relationship between vitamin D and SUA and the risk of higher SUA status. Two-segment generalized linear models (GLM) and logistic models were used to assess the association between vitamin D and SUA and higher SUA status, respectively. The longitudinal analysis used GLM. We observed an inverted U-shaped relationship between vitamin D and SUA (p-overall < 0.0001, p-nonlinear = 0.0002), as well as the risk of higher SUA status (p-overall = 0.0054, p-nonlinear = 0.0015), with the vitamin D inflection point at 24.31 and 21.29 ng/mL, respectively. A 10 ng/mL increment in 25(OH)D3 levels, when below 20.92 ng/mL, was associated with a 68% rise in the risk of higher SUA status (OR: 1.68, 95%CI: 1.07-2.66). Conversely, when 25(OH)D3 levels were above or equal to 20.92 ng/mL, a 10 ng/mL increment was associated with a 45% reduction risk of higher SUA status (OR: 0.55, 95%CI: 0.36-0.84). Longitudinal analysis indicated that the annual change of SUA was from -4.80 (β, 95%CI: -10.74, 1.13) to -9.00 (β, 95%CI: -15.03, -2.99) and then to -6.77 (β, 95%CI: -12.83, -0.71, p for trend = 0.0212) μmol/L when increasing the quartile of vitamin D3. An inverse U-shaped relationship was observed between vitamin D and SUA as well as the risk of higher SUA status. Sufficient vitamin D levels appear to play a preventative role against the age-related increase in SUA. Ensuring adequate vitamin D levels may be beneficial in improving uric acid metabolism.