If gut microbes influence host behavioral ecology in the short term, over evolutionary time, they could drive host niche differentiation. We explored this possibility by comparing the gut microbiota of Madagascar's folivorous lemurs from Indriidae and Lepilemuridae. Occurring sympatrically in the eastern rainforest, our four, target species have different dietary specializations, including frugo-folivory (sifakas), young-leaf folivory (indri and woolly lemurs), and mature-leaf folivory (sportive lemurs). We collected fecal samples, from 2013 to 2017, and used amplicon sequencing, metagenomic sequencing, and nuclear magnetic resonance spectroscopy, respectively, to integrate analyses of gut microbiome structure and function with analysis of the colonic metabolome. The lemurs harbored species-specific microbiomes, metagenomes, and metabolomes that were tuned to their dietary specializations: Frugo-folivores had greater microbial and metagenomic diversity, and harbored generalist taxa. Mature-leaf folivores had greater individual microbiome variation, and taxa and metabolites putatively involved in cellulolysis. The consortia even differed between related, young-leaf specialists, with indri prioritizing metabolism of fiber and plant secondary compounds, and woolly lemurs prioritizing amino-acid cycling. Specialized gut microbiota and associated gastrointestinal morphologies enable folivores to variably tolerate resource fluctuation and support nutrient extraction from challenging resources (e.g., by metabolizing plant secondary compounds or recalcitrant fibers), perhaps ultimately facilitating host species' diversity and specialized feeding ecologies.