Ecological stoichiometry (C:N:P ratios) in soil plays an important role in ecosystem dynamics and functioning; however, its relationship with below-ground microbial diversity following afforestation remains poorly understood. To illustrate the linkage of C, N, and P in soil and microbial biomass, and the effect on the soil bacterial community, soil samples were collected from farmland and from three afforested land, namely Robinia pseudoacacia L., Caragana korshinskii Kom, and abandoned land, which have been arable for the past 40years. Quantitative PCR and Illumina sequencing of the 16S rRNA genes were used to analyze soil bacterial abundance, diversity, and composition. Additionally, soil properties and C, N, and P levels in soil and microbial biomass were estimated. The results revealed that C, N, and P levels in soil and microbial biomass increased following afforestation, with a significant correlation observed, especially for the N:P ratio. Additionally, a rise in 〈alpha〉- and 〈beta〉-diversity of soil bacteria was observed in response to afforestation, and was linked to soil C:P and N:P ratios. Soil bacterial phyla with high relative abundance (relative abundance>1%) across all samples showed inconsistent directional trends in the composition response after afforestation. An increased abundance of Proteobacteria, Acidobacteria, and Nitrospirae were observed, while the abundance of Chloroflexi was opposite (P<0.05) following afforestation. Those were largely influenced by changes in the N:P ratio in soil and microbial biomass. Taken together, significantly increased N:P ratio in soil reflected the deficient P that would be limited for increased microbial biomass and diversity. Thus, P status should be an important factor for sustainable restoration of the forest during the process of afforestation.