Neuromodulation of self-amplifying circuits directs context-dependent behavioral executions. Although recurrent networks are found throughout the Caenorhabditis elegans connectome, few reports describe the mechanisms that regulate reciprocal neural activity during complex behavior. We used C. elegans male copulation to dissect how a goal-oriented motor behavior is regulated by recurrently wired sensory-motor neurons. As the male tail presses against the hermaphrodite's vulva, cholinergic and glutamatergic reciprocal innervations of post cloaca sensilla (PCS) neurons (PCA, PCB, and PCC), hook neurons (HOA, HOB), and their postsynaptic sex muscles execute rhythmic copulatory spicule thrusts. These repetitive spicule movements continue until the male shifts off the vulva or genital penetration is accomplished. However, the signaling mechanism that temporally and spatially restricts repetitive intromission attempts to vulva cues was unclear. Here, we report that confinement of spicule insertion attempts to the vulva is facilitated by D2-like receptor modulation of gap-junctions between PCB and the hook sensillum. We isolated a missense mutation in the UNC-7(L) gap-junction isoform, which perturbs DOP-2 signaling in the PCB neuron and its electrical partner, HOA. The glutamate-gated chloride channel AVR-14 is expressed in HOA. Our analysis of the unc-7 mutant allele indicates that when DOP-2 promotes UNC-7 electrical communication, AVR-14-mediated inhibitory signals pass from HOA to PCB. As a consequence, PCB is less receptive to be stimulated by its recurrent synaptic partner, PCA. Behavioral observations suggest that dopamine neuromodulation of UNC-7 ensures attenuation of recursive intromission attempts when the male disengages or is dislodged from the hermaphrodite genitalia.