Neural circuits detect and process environmental changes to drive appropriate food-seeking or toxin-avoiding behaviors. However, we lack a complete understanding of the cellular and molecular mechanisms that represent chemosensory cues and generate appropriate behaviors. Furthermore, these vital sensory abilities deteriorate with age in humans and most animals, but it is unknown how aging impairs the underlying neural circuits to cause sensory behavioral declines. With powerful genetic tools, a complete connectome and robust chemosensory behaviors, the nematode Caenorhabditis elegans is ideally suited for a circuit-level analysis of these behaviors in young and aged animals. The aim of this dissertation is to identify neural signaling and circuit principles for flexibly encoding chemosensory stimuli and generating behavioral plasticity in C. elegans, which may be broadly conserved. In Chapters 2 and 3, I define a novel, sensory context- dependent and neuropeptide-regulated switch in the composition of a C. elegans salt sensory circuit. The ASE primary salt sensory neurons cleave and release insulin- like peptides in response to large but not small changes in external salt stimuli. Insulin signaling functionally switches the AWC olfactory sensory neuron into an interneuron in the high salt circuit, potentiating behavioral responses. Thus, sensory context and neuropeptide signaling act together to shape the flow of information in active neural circuits, suggesting a general mechanism for generating dynamic behavioral outputs. In Chapter 4, I identify an aging-associated decline in C. elegans olfactory behavior and map a novel underlying circuit motif. Two primary olfactory sensory neuron pairs, AWC and AWA, directly detect benzaldehyde and release insulin peptides and acetylcholine to activate two secondary neuron pairs, ASE and AWB, and drive behavioral plasticity. Interestingly, odor-evoked activity in the secondary, but not primary, neurons degrades with age. Experimental manipulations to increase primary neuron transmitter release rescue these aging-associated neuronal deficits. Furthermore, aged animals' olfactory abilities are correlated with lifespan, suggesting that olfaction may be indicative of overall health and physiology. These results show how chemosensory stimuli are encoded by a population code composed of primary and secondary neurons and suggest reduced neurotransmission as a novel mechanism driving aging-associated sensory neural activity and behavioral declines. In sum, this dissertation establishes the crucial role of peptidergic and classical neurotransmission in defining the active neural circuit configurations that regulate chemosensory behaviors