Exploiters (parasites and predators) are thought to play a significant role in diversification, and ultimately speciation, of their hosts or prey. Exploiters may drive sympatric (within-population) diversification if there are a variety of exploiter-resistance strategies or fitness costs associated with exploiter resistance. Exploiters may also drive allopatric (between-population) diversification by creating different selection pressures and increasing the rate of random divergence. We examined the effect of a virulent viral parasite (phage) on the diversification of the bacterium Pseudomonas fluorescens in spatially structured microcosms. Here we show that in the absence of phages, bacteria rapidly diversified into spatial niche specialists with similar patterns of diversity across replicate populations. In the presence of phages, sympatric diversity was greatly reduced, as a result of phage-imposed reductions in host density decreasing competition for resources. In contrast, allopatric diversity was greatly increased as a result of phage-imposed selection for resistance, which caused populations to follow divergent evolutionary trajectories. These results show that exploiters can drive diversification between populations, but may inhibit diversification within populations by opposing diversifying selection that arises from resource competition.