The classification of neurons into distinct types reveals hierarchical taxonomic relationships that reflect the extent of similarity between neuronal cell types. At the base of such taxonomies are neuronal cells that are very similar to one another but differ in a small number of reproducible and select features. How are very similar members of a neuron class that share many features instructed to diversify into distinct subclasses? We show here that the six very similar members of the Caenorhabditis elegans IL2 sensory neuron class, which are all specified by a homeobox terminal selector, unc-86/BRN3, differentiate into two subtly distinct subclasses, a dorsoventral subclass and a lateral subclass, by the toggle switch-like action of the sine oculis/SIX homeobox gene unc-39. unc-39 is expressed only in the lateral IL2 neurons, and loss of unc-39 leads to a homeotic transformation of the lateral into the dorsoventral class; conversely, ectopic unc-39 expression converts the dorsoventral subclass into the lateral subclass. Hence, a terminal selector homeobox gene controls both class- as well as subclass-specific features, while a subordinate homeobox gene determines the ability of the class-specific homeobox gene to activate subtype-specific target genes. We find a similar regulatory mechanism operating in a distinct class of six motor neurons. Our findings underscore the importance of homeobox genes in neuronal identity control and invite speculations about homeotic identity transformations as potential drivers of evolutionary novelty during cell-type evolution in the brain.