An organism's gut microbiota can change in response to novel environmental conditions, in particular when colonisation of new habitats is accompanied by shifts in the host species' ecology. Here, we investigated the gut microbiota of three lizard species (A. inornata, H. maculata and S. cowlesi) from their ancestral‐like habitat in the Chihuahuan desert and two colonised habitats with contrasting geological and ecological compositions: the White Sands and Carrizozo lava flow. The host species and the lizards' environment both shape gut microbiota composition, but host effects were overall stronger. Further, we found evidence that colonisation of the same environment by independent host species led to parallel changes of the gut microbiota, whereas the colonisation of two distinct environments by the same host species led to gut microbiota divergence. Some of the gut microbiota changes that accompanied the colonisation of the White Sands were associated with shifts in diet (based on diet information from previous studies), which is congruent with the general observation that trophic ecology has a strong effect on gut microbiota composition. Our study provides insights into how shifts in host ecology accompanying colonisation of novel environments can affect gut microbiota composition and diversity.