This study investigated the diversity, specificity, and functionality of phyllosphere endophytes in alfalfa (*Medicago sativa* L.) to understand their role in silage fermentation. The results showed that alfalfa fermentation with endophytes (EN) enhanced fermentation characteristics compared to phyllosphere bacteria (PB) due to the dominance of specific lactic acid bacteria (LAB) like *Lactiplantibacillus*, *Weissella*, and *Pediococcus*. Inoculation with selected endophytic LAB, particularly *Pediococcus pentosaceus* EN5, further improved fermentation quality. *P. pentosaceus* EN5 showed enrichment of genes related to carbohydrate metabolism and higher carbohydrate utilization. Phyllosphere endophytic LAB demonstrated significant potential for improving ensiling, suggesting a novel approach for developing microbial inoculants.