Perception of temperature is an important brain function for organisms to survive. Evidence suggests that temperature preference behavior (TPB) in Drosophila melanogaster, one of poikilothermal animals, is regulated by cAMP-dependent protein kinase (PKA) signaling in mushroom bodies of the brain. However, downstream targets for the PKA signaling in this behavior have not been identified. From a genome-wide search for the genes regulated by PKA activity in the mushroom bodies, we identified the cyp6a17 Cytochrome P450 gene as a new target for PKA. Our detailed analysis of mutants by genetic, molecular and behavioral assays shows that cyp6a17 is essential for temperature preference behavior. cyp6a17 expression is enriched in the mushroom bodies of the adult brain. Tissue-specific knockdown and rescue experiments demonstrate that cyp6a17 is required in the mushroom bodies for normal temperature preference behavior. This is the first study, to our knowledge, to show PKA-dependent expression of a cytochrome P450 gene in the mushroom bodies and its role as a key factor for temperature preference behavior. Taken together, this study reveals a new PKA-Cytochrome P450 pathway that regulates the temperature preference behavior.