Abstract Thermotaxis is the phenomenon where an organism directs its movement toward its preferred temperature. So far, the molecular origin for this precision-sensing behavior remains a puzzle. We propose a model of Escherichia coli thermotaxis and show that the precision-sensing behavior in E. coli thermotaxis can be carried out by the gradient-sensing chemotaxis pathway under two general conditions. First, the thermosensor response to temperature is inverted by its internal adaptation state. For E. coli, chemoreceptor Tar changes from a warm sensor to a cold sensor on increase of its methylation level. Second, temperature directly affects the adaptation kinetics. The adapted activity in E. coli increases with temperature in contrast to the perfect adaptation to chemical stimuli. Given these two conditions, E. coli thermotaxis is achieved by the cryophilic and thermophilic responses for temperature above and below a critical temperature T c, which is encoded by internal pathway parameters. Our model results are supported by both experiments with adaptation-disabled mutants and the recent temperature impulse response measurements for wild-type cells. T c is predicted to decrease with the background attractant concentration. This mechanism for precision sensing in an adaptive gradient-sensing system may apply to other organisms, such as Dictyostelium discoideum and Caenorhabditis elegans.