We still lack a detailed understanding of the genetic mechanisms that allow species to coexist and hybridize without collapsing. Theory predicts that genetic incompatibilities that reduce fitness of hybrids and recombinants may form barriers to gene flow, particularly in genomic regions of reduced recombination. This has proved difficult to test empirically. Conventional methods for studying the landscape of gene flow across the genome are prone to biases, making them difficult to interpret. We addressed this issue by using novel, and less biased, approaches to study relatedness across the genome between hybridizing species of Heliconius butterflies. We compared two pairs of species using multiple resequenced genomes from multiple replicated regions of sympatry. We found that relatedness between species fluctuates on a large scale across the genome, and that patterns of introgression differ between the two species pairs. In one pair, gene flow is correlated with recombination rate, reduced at chromosome centres and in gene-rich regions. In the other pair, rates of gene flow are more even across the genome. Using simulations, we show that these patterns are consistent with biological differences between the two species pairs. One pair has distinct wing patterns that are under strong ecological selection and may provide a genome-wide barrier to gene flow. The other pair lacks this dramatic ecological difference, so the species boundary depends more on the distribution of genetic incompatibilities and recombination. Our findings therefore supplement theoretical work, showing how the shape of the species boundary reflects the genetic architecture of species differences.