Temperature profoundly influences various life phenomena, and most animals have developed mechanisms to respond properly to environmental temperature fluctuations. To identify genes involved in sensing ambient temperature and in responding to its change, Ͼ27,000 independent P-element insertion mutants of Drosophila were screened. As a result, we found that defects in the genes encoding for proteins involved in histamine signaling [histidine decarboxylase (hdc), histamine-gated chloride channel subunit 1 (hisCl1), ora transientless (ort)] cause abnormal temperature preferences. The abnormal preferences shown in these mutants were restored by genetic and pharmacological rescue and could be reproduced in wild type using the histamine receptor inhibitors cimetidine and hydroxyzine. Spatial expression of these genes was observed in various brain regions including pars intercerebralis, fan-shaped body, and circadian clock neurons but not in dTRPA1-expressing neurons, an essential element for thermotaxis. We also found that the histaminergic mutants showed reduced tolerance for high temperature and enhanced tolerance for cold temperature. Together, these results suggest that histamine signaling may have important roles in modulating temperature preference and in controlling tolerance of low and high temperature.