Processing and storage of information by the nervous system requires the ability to modulate the response of excitable cells to neurotransmitter. A simple process of this type, known as adaptation or desensitization, occurs when prolonged stimulation triggers processes that attenuate the response to neurotransmitter. Here we report that the Caenorhabditis elegans gene unc-2 is required for adaptation to two neurotransmitters, dopamine and serotonin. A loss-of-function mutation in unc-2 resulted in failure to adapt either to paralysis by dopamine or to stimulation of egg laying by serotonin. In addition, unc-2 mutants displayed behaviours similar to those induced by serotonin treatment. We found that unc-2 encodes a homologue of a voltage-sensitive calcium-channel alpha-1 subunit. Expression of unc-2 occurs in two types of neurons implicated in the control of egg laying, a behaviour regulated by serotonin. Unc-2 appears to be required in modulatory neurons to downregulate the response of the egg-laying muscles to serotonin. We propose that adaptation to serotonin occurs through activation of an Unc-2-dependent calcium influx, which modulates the postsynaptic response to serotonin, perhaps by inhibiting the release of a potentiating neuropeptide.