How neurons make specific synaptic connections is a central question in neurobiology. The targeting of the Drosophila R7 and R8 photoreceptor axons to different synaptic layers in the brain provides a model with which to explore the genetic programs regulating target specificity. In principle this can be accomplished by cell-type-specific molecules mediating the recognition between synaptic partners. Alternatively, specificity could also be achieved through cell-type-specific repression of particular targeting molecules. Here we show that a key step in the targeting of the R7 neuron is the active repression of the R8 targeting program. Repression is dependent on NF-YC, a subunit of the NF-Y (nuclear factor Y) transcription factor. In the absence of NF-YC, R7 axons terminate in the same layer as R8 axons. Genetic experiments indicate that this is due solely to the derepression of the R8-specific transcription factor Senseless (Sens) late in R7 differentiation. Sens is sufficient to control R8 targeting specificity and we demonstrate that Sens directly binds to an evolutionarily conserved DNA sequence upstream of the start of transcription of an R8-specific cell-surface protein, Capricious (Caps) that regulates R8 target specificity. We show that R7 targeting requires the R7-specific transcription factor Prospero (Pros) in parallel to repression of the R8 targeting pathway by NF-YC. Previous studies demonstrated that Sens and Pros directly regulate the expression of specific rhodopsins in R8 and R7. We propose that the use of the same transcription factors to promote the cell-type-specific expression of sensory receptors and cell-surface proteins regulating synaptic target specificity provides a simple and general mechanism for ensuring that transmission of sensory information is processed by the appropriate specialized neural circuits.