Repeated use of illicit drugs produces long-lasting and prepotent drug-cue associations that increase vulnerability for relapse in individuals with a substance use disorder. Epigenetic factors like histone deacetylase 5 (HDAC5) play a key role in regulating the formation of drug-cue associations, but the underlying mechanisms remain unclear. We show here that two conserved cysteines located near HDAC5’s catalytic domain are required for its intrinsic deacetylase activity, and that HDAC5’s deacetylase activity is required in nucleus accumbens (NAc) medium spiny neurons (MSNs) to limit their intrinsic excitability and relapse-like cue-reinstated cocaine seeking. Moreover, we show that HDAC5 limits NAc MSN firing rate and cue-reinstated cocaine seeking by deacetylase-dependent repression of Scn4b, a novel HDAC5 target gene that encodes an auxiliary subunit of voltage-gated ion channels. Taken together, our data suggest that epigenetic control of NAc Scn4b governs the plasticity underlying formation of drug-cue associations through modulation of NAc MSN intrinsic excitability.