Opioid use disorder (OUD) is a chronic, relapsing condition with severe negative health consequences. Previous studies have reported that 5-year opioid abstinence is a good predictor of reduced likelihoods of relapse, but factors that shape long-term opioid abstinence are poorly understood. The present study is based on data from a prospective study of 699 adults with OUD who had been randomized to either methadone or buprenorphine/naloxone and who were followed for at least 5 years. During the 5 years prior to the participants' last follow-up interview, 232 (33.2%) had achieved 5-year abstinence from heroin. Of those 232, 145 (20.7% of the total) had remained abstinent from both heroin and other opioids (e.g., hydrocodone, oxycodone, other opioid analgesics, excluding methadone or buprenorphine). Compared to non-abstinent individuals, those in both categories of opioid abstinence had lower problem severity in health and social functioning at the final follow-up. Logistic regression results indicated that cocaine users and injection drug users were less likely to achieve 5-year heroin abstinence, whereas Hispanics (vs. whites) and those treated in clinics on the West Coast (vs. East) were less likely to achieve 5-year abstinence from heroin and other opioids. For both abstinence category groups, abstinence was positively associated with older age at first opioid use, lower impulsivity, longer duration of treatment for OUD, and greater social support. Reducing cocaine use and injection drug use and increasing social support and retention in treatment may help maintain long-term abstinence from opioids among individuals treated with agonist pharmacotherapy.