Trigeminal nuclei and the dorsal spinal cord are first-order relay stations for processing somatic sensory information such as touch, pain, and temperature. The origins and development of these neurons are poorly understood. Here we show that relay somatic sensory neurons and D2/D4 dorsal interneurons likely derive from Mash1-positive neural precursors, and depend on two related homeobox genes, Rnx and Tlx-1, for proper formation. Rnx and Tlx-1 maintain expression of Drg11, a homeobox gene critical for the development of pain circuitry, and are essential for the ingrowth of trkA+ nociceptive/thermoceptive sensory afferents to their central targets. We showed previously that Rnx is necessary for proper formation of the nucleus of solitary tract, the target for visceral sensory afferents. Together, our studies demonstrate a central role for Rnx and Tlx-1 in the development of two major classes of relay sensory neurons, somatic and visceral.