Buprenorphine is an effective medication for opioid use disorder that reduces mortality; however, many patients are not retained in buprenorphine treatment, and an optimal length of treatment after which patients can safely discontinue treatment has not been identified. This study measured the association between buprenorphine treatment duration and all-cause mortality among patients who discontinued treatment. Secondary objectives were to measure the association between treatment duration and drug overdose and opioid-related overdoses. Multi-site cohort study. Eight US health systems. Patients who initiated and discontinued buprenorphine treatment between 1 January 2012 and 31 December 2018 (n = 6550). Outcomes occurring after patients discontinued buprenorphine treatment were compared between patients who initiated and discontinued treatment after 8-30, 31-90, 91-180, 181-365 and > 365 days. Covariate data were obtained from electronic health records (EHRs). Mortality outcomes were derived from EHRs and state vital statistics. Non-fatal opioid and drug overdoses were obtained from diagnostic codes. Four sites provided cause-of-death data to identify fatal drug and opioid-related overdoses. Adjusted frailty regression was conducted on a propensity-weighted cohort to assess associations between duration of the final treatment episode and outcomes. The mortality rate after buprenorphine treatment was 1.82 per 100 person-years (n = 191 deaths). In regression analyses with > 365 days as the reference group, treatment duration was not associated with all-cause mortality and drug overdose (P > 0.05 for both). However, compared with > 365 days of treatment, 91-180 days of treatment was associated with increased opioid overdose risk (hazard ratio = 2.94, 95% confidence interval = 1.11-7.79). Among patients who discontinue buprenorphine treatment, there appears to be no treatment duration period associated with a reduced risk for all-cause mortality. Patients who discontinue buprenorphine treatment after 91-180 days appear to be at heightened risk for opioid overdose compared with patients who discontinue after > 365 days of treatment.