Sexual reproduction in eukaryotes requires the fusion of two compatible gametes of opposite sexes or mating types. To meet the challenge of finding a mating partner with compatible gametes, evolutionary mechanisms such as hermaphroditism and self-fertilization have repeatedly evolved. Here, by combining the insights from comparative genomics, computer simulations and experimental evolution in fission yeast, we shed light on the conditions promoting separate mating types or self-compatibility by mating-type switching. Analogous to multiple independent transitions between switchers and non-switchers in natural populations mediated by structural genomic changes, novel switching genotypes readily evolved under selection in the experimental populations. Detailed fitness measurements accompanied by computer simulations show the benefits and costs of switching during sexual and asexual reproduction, governing the occurrence of both strategies in nature. Our findings illuminate the trade-off between the benefits of reproductive assurance and its fitness costs under benign conditions facilitating the evolution of self-compatibility.