Social isolation causes profound changes in social behaviour in a variety of species including humans, monkeys, mice, bees, and vinegar flies. However, the genetic and molecular mechanisms modulating behavioural responses to both social isolation and social recovery remain to be elucidated. In this study, we quantified the behavioural response of vinegar flies to social isolation through the use of two distinct protocols, one involving flies’ social space preference and the other assessing flies’ sociability, defined as their spontaneous tendencies to form groups. We found that social isolation increased social space and reduced sociability. These effects of social isolation, however, were reversible and could be reduced after 3 days of group housing. Flies with a loss of function ofneuroligin3(ortholog of autism-relatedneuroligingenes) with known increased social space in a socially enriched environment, were still able to recover from social isolation. Using aUAS-TH-RNAi driven in all neurons, we show that dopamine is important for a response to social isolation and recovery in males but not in females. Furthermore, only in males, dopamine levels are reduced after isolation and are not recovered after group housing. Finally, in socially enriched flies with a loss of function ofneuroligin3, dopamine levels are reduced in males, but not in females. We propose a model to explain how dopamine andneuroligin3are involved in the behavioural response to social isolation and its recovery in a dynamic and sex-specific manner.