Humans and other animals can sense temperature changes as small as 0.1 degree C. How animals achieve such exquisite sensitivity is poorly understood. By recording from the C. elegans thermosensory neurons AFD in vivo, we found that cooling closes and warming opens ion channels. We found that AFD thermosensitivity, which exceeds that of most biological processes by many orders of magnitude, is achieved by nonlinear signal amplification. Mutations in genes encoding subunits of a cyclic guanosine monophosphate (cGMP)-gated ion channel (tax-4 and tax-2) and transmembrane guanylate cyclases (gcy-8, gcy-18 and gcy-23) eliminated both cooling- and warming-activated thermoreceptor currents, indicating that a cGMP-mediated pathway links variations in temperature to changes in ionic currents. The resemblance of C. elegans thermosensation to vertebrate photosensation and the sequence similarity between TAX-4 and TAX-2 and subunits of the rod phototransduction channel raise the possibility that nematode thermosensation and vertebrate vision are linked by conserved evolution.