Crop rotation increases crop yield, improves soil health, and reduces plant disease. However, few studies were conducted on the use of intensive cropping patterns to improve the microenvironment of saline soils. The present study thoroughly evaluated the impact of a three-year maize-peanut-millet crop rotation pattern on the crop yield. The rhizosphere soil of the crop was collected at maturity to assess the effects of crop rotation on the composition and function of microbial communities in different tillage layers (0-20 cm and 20-40 cm) of sandy saline-alkaline soils. After three years of crop rotation, the maize yield and economic benefits rose by an average of 32.07% and 22.25%, respectively, while output/input grew by 10.26%. The pH of the 0-40 cm tillage layer of saline-alkaline soils decreased by 2.36%, organic matter rose by 13.44%-15.84%, and soil-available nutrients of the 0-20 cm tillage layer increased by 11.94%-69.14%. As compared to continuous cropping, crop rotation boosted soil nitrogen and phosphorus metabolism capacity by 8.61%-88.65%. Enrichment of Actinobacteria and Basidiomycota increased crop yield. Crop rotation increases microbial community richness while decreasing diversity. The increase in abundance can diminish competitive relationships between species, boost synergistic capabilities, alter bacterial and fungal community structure, and enhance microbial community function, all of which elevate crop yields. The obtained insights can contribute to achieving optimal management of intensive cultivation patterns and green sustainable development.