The nucleus accumbens is a key mediator of cocaine reward, but the distinct roles of the two subpopulations of nucleus accumbens projection neurons, those expressing dopamine D1 versus D2 receptors, are poorly understood. We show that deletion of TrkB, the brain-derived neurotrophic factor (BDNF) receptor, selectively from D1+ or D2+ neurons oppositely affects cocaine reward. Because loss of TrkB in D2+ neurons increases their neuronal excitability, we next used optogenetic tools to control selectively the firing rate of D1+ and D2+ nucleus accumbens neurons and studied consequent effects on cocaine reward. Activation of D2+ neurons, mimicking the loss of TrkB, suppresses cocaine reward, with opposite effects induced by activation of D1+ neurons. These results provide insight into the molecular control of D1+ and D2+ neuronal activity as well as the circuit-level contribution of these cell types to cocaine reward.