Many biodiversity hotspots are in montane regions, and many plant and animal groups have their highest species richness at intermediate elevations. Yet, the explanation for this hump-shaped diversity pattern has remained unclear because no studies have addressed both the ecological and evolutionary causes. Here, we address these causes in North American plethodontid salamanders, using a near-comprehensive phylogeny and environmental data. We develop a null model for assessing the relationship between the time that an area has been occupied and its species richness, and we apply a new approach that tests whether clades exhibit long-term stasis in their climatic niches (niche conservatism). Evolutionarily, the midelevation peak in species richness is explained by the time-for-speciation effect, with intermediate-elevation habitats seemingly being inhabited longest and accumulating more species. We find that this pattern is associated with evolutionary stasis in species' climatic niches, driving the midelevation peak by constraining the dispersal of lineages to environments at lower and higher elevations. These processes may help explain elevational diversity patterns in many montane regions around the world. The results also suggest that montane biotas may harbor high levels of both species diversity and phylogenetic diversity but may be particularly susceptible to rapid climate change.