Dysfunction in prosocial interactions is a core symptom of autism spectrum disorder. However, the neural mechanisms that underlie sociability are poorly understood, limiting the rational development of therapies to treat social deficits. Here we show in mice that bidirectional modulation of the release of serotonin (5-HT) from dorsal raphe neurons in the nucleus accumbens bidirectionally modifies sociability. In a mouse model of a common genetic cause of autism spectrum disorder-a copy number variation on chromosome 16p11.2-genetic deletion of the syntenic region from 5-HT neurons induces deficits in social behaviour and decreases dorsal raphe 5-HT neuronal activity. These sociability deficits can be rescued by optogenetic activation of dorsal raphe 5-HT neurons, an effect requiring and mimicked by activation of 5-HT1b receptors in the nucleus accumbens. These results demonstrate an unexpected role for 5-HT action in the nucleus accumbens in social behaviours, and suggest that targeting this mechanism may prove therapeutically beneficial.