Over the past 3 million years, humans have expanded their ecological niche and adapted to more diverse environments. The temporal evolution and underlying drivers behind this niche expansion remain largely unknown. By combining archeological findings with landscape topographic data and model simulations of the climate and biomes, we show that human sites clustered in areas with increased terrain roughness, corresponding to higher levels of biodiversity. We find a gradual increase in human habitat preferences toward rough terrains until about 1.1 million years ago (Ma), followed by a 300 thousand-year-long contraction of the ecological niche. This period coincided with the Mid-Pleistocene Transition and previously hypothesized ancestral population bottlenecks. Our statistical analysis further reveals that from 0.8 Ma onward, the human niche expanded again, with human species (e.g., H. heidelbergensis, H. neanderthalensis, and H. sapiens) adapting to rougher terrain, colder and drier conditions, and toward regions of higher ecological diversity.