The gut microbiomes of the host are large and complex communities, which helps to maintain homeostasis, improves digestive efficiency, and promotes the development of the immune system. The small mammals distributed in Sichuan Province are the most popular species for biodiversity research in Southwest China. However, the effects of different diets on the structure and function of the gut microbial community of these small mammals are poorly understood. In this study, whole-metagenome shotgun sequencing has been used to analyze the composition and functional structures of the gut microbiota of seven small mammals in Laojunshan National Nature Reserve, Sichuan Province, China. Taxonomic classification revealed that the most abundant phyla in the gut of seven small mammals were Bacteroides, Proteobacteria and Firmicutes. Moreover, Hafnia, Raoultella and Aeromonas were most abundant genus in the gut microbiomes of these seven species. At the functional level, we annotated a series of KEGG functional pathways, six Cazy categories and 46,163 AROs in the gut microbiomes of the seven species. Comparative analysis found that the difference in the gut microbiomes between the Soricidea and Muridae concentrated on the increase in the F/B (Firmicutes/Bacteroides) ratio in the Soricidea group, probably driven by the high fat and calorie digestive requirements due to their insectivorous diet. The comparative functional profiling revealed that functions related to metabolism and carbohydrates were significantly more abundant in Muridae group, which may be attributed to their high carbohydrate digestion requirements caused by their herbivorous diet. These data suggested that different diets in the host may play an important role in shaping the gut microbiota, and lay the foundation for teasing apart the influences of heritable and environmental factors on the evolution of gut microbial communities.