The gastrointestinal (GI) microbiome contributes significantly to host nutrition and health. However, relationships involving GI microbes, their hosts and host macrohabitats remain to be established. Here, we define clear patterns of variation in the GI microbiomes of six groups of Mexican black howler monkeys (Alouatta pigra) occupying a gradation of habitats including a continuous evergreen rainforest, an evergreen rainforest fragment, a continuous semi-deciduous forest and captivity. High throughput microbial 16S ribosomal RNA gene sequencing indicated that diversity, richness and composition of howler GI microbiomes varied with host habitat in relation to diet. Howlers occupying suboptimal habitats consumed less diverse diets and correspondingly had less diverse gut microbiomes. Quantitative real-time PCR also revealed a reduction in the number of genes related to butyrate production and hydrogen metabolism in the microbiomes of howlers occupying suboptimal habitats, which may impact host health.