Divergent habitat preferences can contribute to speciation, as has been observed for host-plant preferences in phytophagous insects. Geographic variation in host preference can provide insight into the causes of preference evolution. For example, selection against maladaptive host-switching occurs only when multiple hosts are available in the local environment and can result in greater divergence in regions with multiple vs. a single host. Conversely, costs of finding a suitable host can select for preference even in populations using a single host. Some populations of Timema cristinae occur in regions with only one host-plant species present (in allopatry, surrounded by unsuitable hosts) whereas others occur in regions with two host-plant species adjacent to one another (in parapatry). Here, we use host choice and reciprocal-rearing experiments to document genetic divergence in host preference among 33 populations of T. cristinae. Populations feeding on Ceanothus exhibited a stronger preference for Ceanothus than did populations feeding on Adenostoma. Both allopatric and parapatric pairs of populations using the different hosts exhibited divergent host preferences, but the degree of divergence tended to be greater between allopatric pairs. Thus, gene flow between parapatric populations apparently constrains divergence. Host preferences led to levels of premating isolation between populations using alternate hosts that were comparable in magnitude to previously documented premating isolation caused by natural and sexual selection against migrants between hosts. Our findings demonstrate how gene flow and different forms of selection interact to determine the magnitude of reproductive isolation observed in nature.