In bacteria various tactic responses are mediated by the same cellular pathway, but sensing of physical stimuli remains poorly understood. Here, we combine an in-vivo analysis of the pathway activity with a microfluidic taxis assay and mathematical modeling to investigate the thermotactic response of Escherichia coli. We show that in the absence of chemical attractants E. coli exhibits a steady thermophilic response, the magnitude of which decreases at higher temperatures. Adaptation of wild-type cells to high levels of chemoattractants sensed by only one of the major chemoreceptors leads to inversion of the thermotactic response at intermediate temperatures and bidirectional cell accumulation in a thermal gradient. A mathematical model can explain this behavior based on the saturation-dependent kinetics of adaptive receptor methylation. Lastly, we find that the preferred accumulation temperature corresponds to optimal growth in the presence of the chemoattractant serine, pointing to a physiological relevance of the observed thermotactic behavior.