The formation of stable genetic boundaries between emerging species is often diagnosed by reduced hybrid fitness relative to parental taxa. This reduced fitness can arise from endogenous and/or exogenous barriers to gene flow. Although detecting exogenous barriers in nature is difficult, we can estimate the role of ecological divergence in driving species boundaries by integrating molecular and ecological niche modelling tools. Here, we focus on a three-way secondary contact zone between three viper species (Vipera aspis, V. latastei and V. seoanei) to test for the contribution of ecological divergence to the development of reproductive barriers at several species traits (morphology, nuclear DNA and mitochondrial DNA). Both the nuclear and mitochondrial data show that all taxa are genetically distinct and that the sister species V. aspis and V. latastei hybridize frequently and backcross over several generations. We find that the three taxa have diverged ecologically and meet at a hybrid zone coincident with a steep ecotone between the Atlantic and Mediterranean biogeographical provinces. Integrating landscape and genetic approaches, we show that hybridization is spatially restricted to habitats that are suboptimal for parental taxa. Together, these results suggest that niche separation and adaptation to an ecological gradient confer an important barrier to gene flow among taxa that have not achieved complete reproductive isolation.