The lateral habenula encodes aversive stimuli contributing to negative emotional states during drug withdrawal. Here we report that morphine withdrawal in mice leads to microglia adaptations and diminishes glutamatergic transmission onto raphe-projecting lateral habenula neurons. Chemogenetic inhibition of this circuit promotes morphine withdrawal-like social deficits. Morphine withdrawal-driven synaptic plasticity and reduced sociability require tumor necrosis factor-α (TNF-α) release and neuronal TNF receptor 1 activation. Hence, habenular cytokines control synaptic and behavioral adaptations during drug withdrawal.