Natural selection is not the only mechanism that promotes adaptation of an organism to its environment. Another mechanism is matching habitat choice, in which individuals sense and disperse toward habitat best suited to their phenotype. This can in principle facilitate rapid adaptation, enhance range expansion, and promote genetic differentiation, reproductive isolation, and speciation. However, empirical evidence that confirms the evolution of matching habitat choice in nature is limited. Here we obtain theoretical evidence that phenotype-optimal dispersal, a particular form of matching habitat choice, is likely to evolve only in the presence of a steep environmental gradient. Such a gradient may be steeper than the gradient the majority of species typically experience in nature, adding to the collection of possible explanations for the scarcity of evidence for matching habitat choice. We draw this conclusion from numerical simulations of a system of deterministic partial differential equations for a population’s density along with the mean and variance of a fitness-related quantitative phenotypic trait, such as body size. In a steep gradient, we find that phenotype-optimal dispersal facilitates rapid adaptation on single-generation time scales, reduces within-population trait variation, increases range expansion speed, and enhances the chance of survival in rapidly changing environments. Moreover, it creates a directed gene flow that reverses the maladaptive core-to-edge effects of random gene flow caused by random movements. These results suggest that adaptive gene flow to range margins, together with substantially reduced trait variation at central populations, may be hallmarks of phenotype-optimal dispersal in natural populations.