Few studies have been reported on the effect of planting years on fruit quality and soil of pear trees. In this study, four planting years (T5, T20, T30, and T40) of Cuiguan pears were used to analyze fruit quality, rhizosphere soil enzymes, and microbial diversity of pear trees, and their correlations. The results showed that the content of sucrose, reducing sugar and ascorbic acid in Cuiguan Pear showed a tendency of increasing and then decreasing with the increase of planting years, in which the highest content was found in 20- and 30-year-old fruits, and the highest content of total acid was found in 5-year-old fruits. Rhizosphere soil enzyme activities varied with planting year, with the highest protease activity in 20-year-old soil, phosphatase and urease in 30-year-old soil, polyphenol oxidase in 5-year-old soil, and sucrase in 40-year-old soil. The microbial diversity index and the number of OTUs showed an increasing and decreasing trend with the increase of planting years. Among the top 11 bacteria in pear rhizosphere soil average relative abundance, with Bradyrhizobium decreasing in relative abundance at the peak pear fruiting stages (T20 and T30), while Acidothermus showed an increasing trend in relative abundance with increasing planting years. RDA analysis showed that there were differences in the microbial community structure of pear trees at different planting years, and that both sucrose and reducing sugar contents in pears were positively correlated with T20 and T30, ascorbic acid content was positively correlated with T40, whereas the total acid content was positively correlated with T5, and that T20 was positively correlated with soil protease and phosphate mono esterase activities, and that T30 was positively correlated with polyphenol oxidase and urease activities, whereas T40 was positively correlated with sucrase activity. In summary, with the increase of planting years, changes in soil microbial community structure and soil enzyme activity have a significant impact on pear quality formation, and the results of the study provide a theoretical basis for scientific management of pear orchards.