Effects of heavy metals on soil microbial communities have been extensively studied due to their persistence in the environment and imposed threats to living organisms; however, there is a lack of in-depth studies of the impacts of heavy metals on plant endophyte communities. Therefore, the responses of plant endophyte communities to different concentrations of heavy metals were investigated in this study. The endophyte communities of plants existing in severely (W1, Pb, 110.49 mg/kg, Cd, 1.11 mg/kg), moderately (W2, Pb, 55.06 mg/kg, Cd, 0.48 mg/kg), and mildly (W3, Pb, 39.06 mg/kg, Cd, 0.20 mg/kg) contaminated soils were analyzed by 16s rRNA high-throughput Illumina sequencing. Furthermore, networks were constructed to illustrate the relationships between microorganisms and environmental factors. High-quality sequences were clustered at a 97% similarity level. Results revealed that the diversity of the community and relative abundance of Cyanobacteria phylum increased with decreasing levels of pollution. Cyanobacteria and Proteobacteria were found to be the dominant phylum, while Methylobacterium and Sphingomonas were observed as the dominant genus. Tukey’s HSD test showed that the relative abundances of Cyanobacteria and Proteobacteria phyla and Methylobacterium and Sphingomonas genera differed significantly (p < 0.01) among the plants of the three sample sites. Environmental factor analysis revealed a significant negative correlation (p < 0.01) of Cyanobacteria and a significant positive correlation (p < 0.01) of Methylobacterium with the heavy metal content in the environment. These findings suggest that Cyanobacteria and Methylobacterium may be phylum and genus indicators, respectively, of heavy metal toxicity. Tax4Fun analysis showed the effect of heavy metal toxicity on the abundance of genes involved in plant metabolism. In addition, culturable endophytic strains were isolated to study their resistance to heavy metal stress and their ability to promote plant growth. The potting tests showed that the JG1 strain was tolerant to heavy metals, and it could significantly promote the growth of the host plant under stress caused by multiple heavy metals. Compared to the control, the JG1-treated plants showed a 23.14% increase in height and a 12.84% increase in biomass. Moreover, AP, AK, and HN contents in JG1-treated plants were 20.87%, 12.55%, and 9.03% higher, respectively, under heavy metal stress. The results of this study provide a scientific basis for the construction of an efficient plant endophyte restoration system.