Serotonin (5-HT) modulates synaptic efficacy in the nervous system of vertebrates and invertebrates. In the nematode Caenorhabditis elegans, many behaviors are regulated by 5-HT levels, which are in turn regulated by the presence or absence of food. Here, we show that both food and 5-HT signaling modulate chemosensory avoidance response of octanol in C elegans, and that this modulation is both rapid and reversible. Sensitivity to octanol is decreased when animals are off food or when 5-HT levels are decreased; conversely, sensitivity is increased when animals are on food or have increased 5-HT signaling. Laser microsurgery and behavioral experiments reveal that sensory input from different subsets of octanol-sensing neurons is selectively used, depending on stimulus strength, feeding status, and 5-HT levels. 5-HT directly targets at least one pair of sensory neurons, and 5-HT signaling requires the Galpha protein GPA-11. Glutamatergic signaling is required for response to octanol, and the GLR-1 glutamate receptor plays an important role in behavioral response off food but not on food. Our results demonstrate that 5-HT modulation of neuronal activity via G protein signaling underlies behavioral plasticity by rapidly altering the functional circuitry of a chemosensory circuit.