Our understanding of evolution in marine ecosystems is framed by theories of speciation developed in terrestrial environments. In the ocean, however, speciation processes are likely to be different than on land. A general lack of absolute barriers, and the vast distances certain organisms can travel as larvae, mean that populations likely diverge in the presence of gene flow. The objective of this dissertation is to examine the relative contribution of different mechanisms of divergence in the sea in order to deepen our understanding of speciation. We examined the population genetics of ectoparasitic snails (Coralliophila radula, C. violacea) that specialize on Porites corals, and occupy a vast geographic and environmental range across the Indo-Pacific. In Chapter One, we used a comparative phylogeographic approach to explore whether populations of both taxa diverged across common geographic barriers, or due to adaptation to the host. We found striking evidence of genetic structure with geography for both snail species, and structure concordant with host within C. violacea populations. These findings suggest that in addition to historical sea level fluctuations, symbioses also contribute to diversification of these snails in the Coral Triangle. In Chapter Two, we used genome-wide data (SNPs) to investigate whether the ecological divergence we observed in C. violacea occurred via directional selection on different hosts and identify loci under selection. We saw genetic evidence of snail migration between hosts, as well as hybridization. By testing for FST outliers, we found loci under divergent selection, including a gene involved in the control of xenobiotic detoxification pathway gene expression, perhaps allowing snails to neutralize coral-specific toxins. These findings provide strong support for ecological divergence with gene flow, driven by adaptation to host. In Chapter Three, we focused on one ecomorph of C. violacea that inhabits coral reefs across a range of environmental conditions. Using genome-wide data and a global ocean-climate database, we identified signatures of geographic isolation and local adaptation. We saw four genetically distinct groups, consistent with results from Chapter One, with most divergence in peripheral populations. Searching for genetic associations with ocean climate variables, we found that the strongest driver of local adaptation was sea surface temperature variation. Our results show that local adaption to different environments likely reinforces neutral divergence, especially in peripheral populations.