Preclinical and human studies indicate psilocybin may reduce perseverant maladaptive behaviors, including nicotine and alcohol seeking. Such studies in the opioid field are lacking, though opioids are involved in more >50% of overdose deaths. Psilocybin is an agonist at the serotonin 2A receptor (5-HT2AR), a well-documented target for modulation of drug seeking, and evidence suggests 5-HT2AR agonists may dampen motivation for opioids. We sought to investigate the therapeutic efficacy of psilocybin in mediating cessation of opioid use and maintenance of long-lasting abstinence from opioid seeking behavior in a rat model of heroin self-administration (SA). Psilocybin or 5-HT2AR antagonists ketanserin and volinanserin were administered systemically to rats prior to SA of 0.075 mg/kg/infusion of heroin, or relapse following forced abstinence. Psilocybin did not alter heroin taking, but a single exposure to 3.0 mg/kg psilocybin 4-24 hours prior to a relapse test blunted cue-induced heroin seeking. Conversely, 5-HT2AR antagonists exacerbated heroin relapse. To begin to elucidate mechanisms of psilocybin, drug-naïve rats received psilocybin and/or ketanserin, and tissue was collected from the prefrontal cortex (PFC), a region critical for drug seeking and responsive to psilocybin, 24 hours later for RNA-sequencing. 3.0 mg/kg psilocybin regulated ∼2-fold more genes in the PFC than 1.0 mg/kg, including genes involved in the cytoskeleton and cytokine signaling. Ketanserin blocked >90% of psilocybin-regulated genes, including the IL-17a cytokine receptor,Il17ra. Psychedelic compounds have reported anti-inflammatory properties, and therefore we performed a gene expression array to measure chemokine/cytokine molecules in the PFC of animals that displayed psilocybin-mediated inhibition of heroin seeking. Psilocybin regulated 4 genes, includingIl17a, and a subset of genes correlated with relapse behavior. Selective inhibition of PFC IL-17a was sufficient to reduce heroin relapse. We conclude that psilocybin reduces heroin relapse and highlight IL-17a signaling as a potential downstream pathway of psilocybin that also reduces heroin seeking.