A hub-and-spoke circuit of neurons connected by gap junctions controls aggregation behavior and related behavioral responses to oxygen, pheromones, and food in Caenorhabditis elegans. The molecular composition of the gap junctions connecting RMG hub neurons with sensory spoke neurons is unknown. We show here that the innexin gene unc-9 is required in RMG hub neurons to drive aggregation and related behaviors, indicating that UNC-9-containing gap junctions mediate RMG signaling. To dissect the circuit in detail, we developed methods to inhibit unc-9-based gap junctions with dominant-negative unc-1 transgenes. unc-1(dn) alters a stomatin-like protein that regulates unc-9 electrical signaling; its disruptive effects can be rescued by a constitutively active UNC-9::GFP protein, demonstrating specificity. Expression of unc-1(dn) in RMG hub neurons, ADL or ASK pheromone-sensing neurons, or URX oxygen-sensing neurons disrupts specific elements of aggregation-related behaviors. In ADL, unc-1(dn) has effects opposite to those of tetanus toxin light chain, separating the roles of ADL electrical and chemical synapses. These results reveal roles of gap junctions in a complex behavior at cellular resolution and provide a tool for similar exploration of other gap junction circuits.innexin | neural circuits | electrical synapses | stomatin | sensory behavior