Drug-evoked synaptic plasticity is observed at many synapses and may underlie behavioural adaptations in addiction. Mechanistic investigations start with the identification of the molecular drug targets. Cocaine, for example, exerts its reinforcing and early neuroadaptive effects by inhibiting the dopamine transporter, thus causing a strong increase in mesolimbic dopamine. Among the many signalling pathways subsequently engaged, phosphorylation of the extracellular signal-regulated kinase (ERK) in the nucleus accumbens is of particular interest because it has been implicated in NMDA-receptor and type 1 dopamine (D1)-receptor-dependent synaptic potentiation as well as in several behavioural adaptations. A causal link between drug-evoked plasticity at identified synapses and behavioural adaptations, however, is missing, and the benefits of restoring baseline transmission have yet to be demonstrated. Here we find that cocaine potentiates excitatory transmission in D1-receptor-expressing medium-sized spiny neurons (D1R-MSNs) in mice via ERK signalling with a time course that parallels locomotor sensitization. Depotentiation of cortical nucleus accumbens inputs by optogenetic stimulation in vivo efficiently restored normal transmission and abolished cocaine-induced locomotor sensitization. These findings establish synaptic potentiation selectively in D1R-MSNs as a mechanism underlying a core component of addiction, probably by creating an imbalance between distinct populations of MSNs in the nucleus accumbens. Our data also provide proof of principle that reversal of cocaine-evoked synaptic plasticity can treat behavioural alterations caused by addictive drugs and may inspire novel therapeutic approaches involving deep brain stimulation or transcranial magnetic stimulation.