Dopamine has been implicated in the modulation of diverse forms of behavioral plasticity, including appetitive learning and addiction. An important challenge is to understand how dopamine's effects at the cellular level alter the properties of neural circuits to modify behavior. In the nematode C. elegans, dopamine modulates habituation of an escape reflex triggered by body touch. In the absence of food, animals habituate more rapidly than in the presence of food; this contextual information about food availability is provided by dopaminergic mechanosensory neurons that sense the presence of bacteria. We find that dopamine alters habituation kinetics by selectively modulating the touch responses of the anterior-body mechanoreceptors; this modulation involves a D1-like dopamine receptor, a Gq/PLC-beta signaling pathway, and calcium release within the touch neurons. Interestingly, the body touch mechanoreceptors can themselves excite the dopamine neurons, forming a positive feedback loop capable of integrating context and experience to modulate mechanosensory attention.