The cultivation temperature (T(c)) modulates the thermosensory responses exhibited by C. elegans on thermal gradients. The AFD sensory neurons are essential for thermosensory behaviors, but the molecular mechanisms by which temperature is sensed and the memory of the T(c) is encoded are unknown. Here, we show that the CMK-1 Ca2+/calmodulin-dependent protein kinase I (CaMKI) and the TAX-4 cyclic nucleotide-gated channel regulate gene expression, morphology, and functions of the AFD thermosensory neurons. Mutations in cmk-1 and tax-4 result in temperature-dependent defects in AFD-specific gene expression, and TAX-4 functions are required during larval stages to maintain gene expression in the adult. CMK-1 and TAX-4 act cell autonomously to regulate AFD-mediated thermosensory behaviors. The molecular requirements for CMK-1 activity in the AFD neurons appear to be distinct from those previously described. We propose that the activation of distinct programs of AFD-specific gene expression at different temperatures by CMK-1 and TAX-4 enables C. elegans to sense and/or encode a memory for the T(c).