This study analyzed flower bud differentiation and fruiting stages to investigate how the structure of the plant endophytic microbial community in the roots of tomatoes changes with plant senescence. Based on high-throughput sequencing technology, the diversity and relative abundance of endophytic microorganisms (bacteria and fungi) in tomato stems at different growth stages were analyzed. At the same time, based on LEfSe analysis, the differences in endophytic microorganisms in tomato stems at different growth stages were studied. Based on PICRUSt2 function prediction and FUNGuild, we predicted the functions of endophytic bacterial and fungal communities in tomato stems at different growth stages to explore potential microbial functional traits. The results demonstrated that not only different unique bacterial genera but also unique fungal genera could be found colonizing tomato roots at different growth stages. In tomato seedlings, flower bud differentiation, and fruiting stages, the functions of colonizing endophytes in tomato roots could primarily contribute to the promotion of plant growth, stress resistance, and improvement in nutrient cycling, respectively. These results also suggest that different functional endophytes colonize tomato roots at different growth stages.