According to theory, sympatric speciation in sexual eukaryotes is favored when relatively few loci in the genome are sufficient for reproductive isolation and adaptation to different niches. Here we show a similar result for clonally reproducing bacteria, but which comes about for different reasons. In simulated microbial populations, there is an evolutionary tradeoff between early and late stages of niche adaptation, which is resolved when relatively few loci are required for adaptation. At early stages, recombination accelerates adaptation to new niches (ecological speciation) by combining multiple adaptive alleles into a single genome. Later on, without assortative mating or other barriers to gene flow, recombination generates unfit intermediate genotypes and homogenizes incipient species. The solution to this tradeoff may be simply to reduce the number of loci required for speciation, or to reduce recombination between species over time. Both solutions appear to be relevant in natural microbial populations, allowing them to diverge into ecological species under similar constraints as sexual eukaryotes, despite differences in their life histories.