Terrestrial ectotherms are challenged by variation in both mean and variance of temperature. Phenotypic plasticity (thermal acclimation) might mitigate adverse effects, however, we lack a fundamental understanding of the molecular mechanisms of thermal acclimation and how they are affected by fluctuating temperature. Here we investigated the effect of thermal acclimation in Drosophila melanogaster on critical thermal maxima (CTmax) and associated global gene expression profiles as induced by two constant and two ecologically relevant (non-stressful) diurnally fluctuating temperature regimes. Both mean and fluctuation of temperature contributed to thermal acclimation and affected the transcriptome. The transcriptomic response to mean temperatures comprised modification of a major part of the transcriptome, while the response to fluctuations affected a much smaller set of genes, which was highly independent of both the response to a change in mean temperature and to the classic heat shock response. Although the independent transcriptional effects caused by fluctuations were relatively small, they are likely to contribute to our understanding of thermal adaptation. We provide evidence that environmental sensing, particularly phototransduction, is a central mechanism underlying the regulation of thermal acclimation to fluctuating temperatures. Thus, genes and pathways involved in phototransduction are likely of importance in fluctuating climates.