Medicago sativa L. (alfalfa) is an important forage crop throughout the world. Despite the abiotic nutritional components of alfalfa having been extensively studied, there is only limited information on alfalfa endophytes. In this study, thirteen endophytic bacteria were isolated from alfalfa seeds. Bacillus (76·9%) was the most abundant genus, followed by Enterobacter (15·4%), Brevibacterium (7·7%), Geobacillus (7·7%) and Staphylococcus (7·7%). Four of the 13 endophytic bacteria, including Bacillus amyloliquefaciens EnB-alf1, Bacillus subtilis EnB-alf3, EnB-alf5 and EnB-alf13, were capable of significantly extending the lifespan of Caenorhabditis elegans. In addition, B. amyloliquefaciens EnB-alf1 enhanced the resistance of C. elegans to thermal stress whereas B. subtilis EnB-alf3 enhanced the resistance to oxidative stress. Further studies demonstrated that the enhanced lifespan of the worm was depended on the function of DAF-2/DAF-16 and was associated with the colonization of strain in the worms' intestines when strain EnB-alf1 or strain EnB-alf3 was presented to the worms as food sources. Our results suggest that some endophytic Bacillus strains isolated from alfalfa are beneficial on C. elegans health. SIGNIFICANCE AND IMPACT OF THE STUDY: Medicago sativa L. (alfalfa) is an important forage crop throughout the world. Despite the abiotic nutritional components of alfalfa having been extensively studied, there is only limited information available on alfalfa endophytes. Beneficial bacteria residing in the host intestine have been shown to affect host longevity. However, there is limited information available on the functions of alfalfa seed endophytes to nematodes. In this study, four endophytic Bacillus strains isolated from alfalfa seeds were found to significantly extend the lifespan of Caenorhabditis elegans and enhance resistance to thermal and oxidative stress. Our results suggest that some endophytic Bacillus strains isolated from alfalfa seeds can promote good health in C. elegans.