Woody plant expansion is a worldwide ecological problem in grassland ecosystems, leading to variations in plant diversity and soil organic carbon (SOC) of grasslands. However, there are knowledge gaps on the effects of changes in plant diversity on SOC fractions due to woody plant expansion along a precipitation gradient. Twelve grassland sites were selected in arid and semi-arid regions of northern China, comprising six shrub-covered sites and six adjacent shrub-uncovered plots as controls along a precipitation gradient. The results revealed that precipitation dominated the effects of woody plant expansion on plant diversity. Woody plant expansion reduced plant diversity in sites with mean annual precipitation (MAP) of 136-386 mm, but increased plant diversity in sites with MAP of 69-123 mm. Woody plant expansion reduced the TOC, POC and MAOC contents in both topsoil and subsoil of grasslands, and also increased the DOC content in subsoil. Plant diversity in the shrub-covered grasslands showed a weaker positive response to increasing precipitation than that in the controls. TOC and MAOC in the shrub-covered grasslands increased more in response to increasing precipitation than those in the controls. In topsoil, TOC and MAOC exhibited similar trends in both shrub-covered grasslands and controls in response to increasing Shannon index. In shrub-covered grasslands, POC exhibited a hump-shaped relationship with the Shannon index, whereas DOC showed a significant positive association with the Shannon index. During woody plant expansion, plant diversity intensified its influence on TOC and MAOC contents, while weakening its effects on POC and DOC contents along a precipitation gradient. This study contributes a new view on the potential relationship of woody plant expansion - plant diversity-SOC changes.