Homoiotherms, for example mammals, regulate their body temperature with physiological responses such as a change of metabolic rate and sweating. In contrast, the body temperature of poikilotherms, for example Drosophila, is the result of heat exchange with the surrounding environment as a result of the large ratio of surface area to volume of their bodies. Accordingly, these animals must instinctively move to places with an environmental temperature as close as possible to their genetically determined desired temperature. The temperature that Drosophila instinctively prefers has a function equivalent to the 'set point' temperature in mammals. Although various temperature-gated TRP channels have been discovered, molecular and cellular components in Drosophila brain responsible for determining the desired temperature remain unknown. We identified these components by performing a large-scale genetic screen of temperature preference behaviour (TPB) in Drosophila. In parallel, we mapped areas of the Drosophila brain controlling TPB by targeted inactivation of neurons with tetanus toxin and a potassium channel (Kir2.1) driven with various brain-specific GAL4s. Here we show that mushroom bodies (MBs) and the cyclic AMP-cAMP-dependent protein kinase A (cAMP-PKA) pathway are essential for controlling TPB. Furthermore, targeted expression of cAMP-PKA pathway components in only the MB was sufficient to rescue abnormal TPB of the corresponding mutants. Preferred temperatures were affected by the level of cAMP and PKA activity in the MBs in various PKA pathway mutants.