We examined historical patterns of gene flow in the freshwater fish Poecilia butleri in western Mexico. We tested the hypothesis that the boundaries between four freshwater ecological communities (ecoregions) might have limited the movement of P. butleri because changes in species compositions might restrict establishment between adjacent ecoregions, even in situations where a physical barrier is absent. Hence, we predicted that boundaries between ecoregions should correspond to phylogeographical breaks in P. butleri. We also tested the hypothesis that the width of the continental shelf affected historical gene flow in P. butleri because a broad continental shelf provides a greater opportunity for rivers to coalesce during historical episodes of low sea levels as opposed to a narrow continental shelf that should restrict the potential for gene flow among adjacent rivers. Hence, we predicted greater amounts of historical gene flow among neighbouring river basins in the region of western Mexico where the continental shelf is wider, whereas, in the region where the continental shelf is narrower, we expected to detect limited levels of historical gene flow. We analyzed mitochondrial DNA sequence data (cytochrome b) taken from 264 individuals of P. butleri collected from 34 locations distributed across four different ecoregions in western Mexico. To examine patterns of phylogenetic diversification and historical gene flow in P. butleri, we employed several analytical approaches, including traditional tree-based phylogenetic analyses (likelihood and parsimony), haplotype network reconstruction, analyses of molecular variance, and spatial analysis of molecular variance. We found genetic breaks coinciding with two out of three different ecoregion boundaries, suggesting limited historical gene flow. In addition to different species compositions between these adjacent ecoregions, geological features such as the Trans-Mexican Volcanic Belt and the mountainous topography in south-western Mexico, likely contributed to these observed genetic breaks. By contrast, no genetic break was evident between two other ecoregions, a result that partially rejects our first hypothesis. Several results were consistent with our second hypothesis. Changes in the width of the continental shelf in western Mexico are associated with the observed patterns of historical gene flow. Our results indicate that the interactions among multiple geological and biological factors affect the spatial patterns of genetic diversity of widespread freshwater species.