Saccharomyces cerevisiae has a complex system for switching the mating type of haploid cells, requiring the genome to have three mating-type (MAT)-like loci and a mechanism for silencing two of them. How this system originated is unknown, because the three-locus system is present throughout the family Saccharomycetaceae, whereas species in the sister Candida clade have only one locus and do not switch. Here we show that yeasts in a third clade, the methylotrophs, have a simpler two-locus switching system based on reversible inversion of a section of chromosome with MATa genes at one end and MATalpha genes at the other end. In Hansenula polymorpha the 19-kb invertible region lies beside a centromere so that, depending on the orientation, either MATa or MATalpha is silenced by centromeric chromatin. In Pichia pastoris, the orientation of a 138-kb invertible region puts either MATa or MATalpha beside a telomere and represses transcription of MATa2 or MATalpha2. Both species are homothallic, and inversion of their MAT regions can be induced by crossing two strains of the same mating type. The three-locus system of S. cerevisiae, which uses a nonconservative mechanism to replace DNA at MAT, likely evolved from a conservative two-locus system that swapped genes between expression and nonexpression sites by inversion. The increasing complexity of the switching apparatus, with three loci, donor bias, and cell lineage tracking, can be explained by continuous selection to increase sporulation ability in young colonies. Our results provide an evolutionary context for the diversity of switching and silencing mechanisms.