Understanding community assembly is a fundamental goal of ecology and evolutionary biology, because it provides insight into how a given landscape changes in a synergistic fashion. With the current background of global environmental change, studies of how habitat alteration affects local communities often focus on species' responses to community-level changes instead of responses to specific ecological factors that elucidate the roles each factor plays in the final synergistic response. Here, we focus on the specific ecological mechanisms that drive changes in community structure. We investigated compositional patterns of lizard communities among natural and altered habitats (vegetatively sparse, natural, and dense) in the desert steppe ecosystem of Inner Mongolia, China. Habitat alteration induced significant changes in community composition of lizards and was associated with significant changes in both biotic and abiotic niches. Our preference (soil, thermal, and prey) and performance (locomotor, antipredator, and competitive) experiments identified many of the biotic and abiotic factors shaping lizard community responses to habitat change. In the natural habitat, where Phrynocephalus frontalis and Eremias multiocellata codominate, P. frontalis experienced low overlap (across lizard species) in preferred prey. Eremias multiocellata preferred the thermal environment of the natural habitat (and dense habitat), but this one factor did not fully explain its codominance. Phrynocephalus frontalis dominated in the sparse habitat, where this lizard species experienced its preferred tight soil and warm thermal environment and experienced low overlap of preferred prey. In the dense habitat, where E. argus dominates, P. frontalis and E. multiocellata exhibited impeded locomotor performance, whereas E. argus was not impeded by vegetation density. Eremias argus also preferred the thermal environment of the dense habitat (and natural habitat). Our results suggest, furthermore, that adult predation risk was not a major determinant of community divergence among habitats and that competition likely plays a more important role. Interspecific competition for microhabitat use may explain the low abundance of E. argus in the natural habitat and the low abundance of P. frontalis in the dense habitat. Overall, our assessment of lizard preferences and performances explained community composition across habitats. Our focus on ecological mechanisms associated with habitat alteration highlights the importance of vegetation conservation in lizard community management.