Domestic yaks (Bos grunniens) are indigenous to the Tibetan Plateau and display a high diarrhea rate due to poor habitat and husbandry conditions. Lactobacillus has been shown to exert beneficial effects as antimicrobial, growth promotion, and gut microbiota in humans and/or murine models, but the relevant data regarding Lactobacillus isolated from yaks was unavailable. Therefore, this study aimed to investigate the effects of Lactobacillus from yaks on the intestinal microbial community in a mouse model and determine whether Lactobacillus supplementation contributed in alleviating diarrhea by modulating gut microbiota. A total of 12 ileac samples from four groups were collected for 16S rRNA gene amplicon sequencing of V3-V4 region. Results revealed that although Lactobacillus supplementation did not change the diversity of gut microbiota in mice, the proportion of some intestinal microbiota significantly changed. Specifically, the proportion of Lactobacillus and Sphingomonas in the Lactobacillus treated-group (L-group) were increased as compared to control group (C-group), whereas Pantoea, Cutibacterium, Glutamicibacter, Turicibacter, Globicatella, Microbacterium, Facklamia, unidentified_Corynebacteriaceae, Brachybacterium, and Staphylococcus were significantly decreased in the L-group. In contrast, Escherichia coli (E. coli) infection significantly decreased the proportion of beneficial bacteria such as Globicatella, Acinetobacter, Aerococcus, and Comamonas, while loads of pathogenic bacteria significantly increased including Roseburia and Megasphaera. Interestingly, Lactobacillus administration could ameliorate the microbial community structure of E. coli-induced diarrheal mice by reducing the relative abundance of pathogenic bacteria such as Paenibacillus, Aerococcus, Comamonas, Acinetobacter, Corynebacterium, Facklamia, and Globicatella. Results in this study revealed that Lactobacillus supplementation not only improved the gut microbiota but also alleviated diarrhea in mice, which may be mediated by modulating the composition and function of gut microbiota. Moreover, this study is expected to provide a new theoretical basis for the establishment of a preventive and treatment system for diarrhea in yaks.