OBJECTIVES: The aim of the study was to investigate the influence of continued injecting drug use, enrolment in an opiate substitution treatment programme (OSTP), or cessation of injecting drug use on the uptake and course of antiretroviral therapy (ART). Design A prospective observational study of all participants in the Swiss HIV Cohort Study followed between 1997 and 2006 was carried out. METHODS: We distinguished four groups of former or current injecting drug users (IDUs): (i) abstinent former IDUs; (ii) persons in OSTPs without concomitant injecting drug use; (iii) persons in OSTPs with concomitant injecting drug use; (vi) current IDUs. These groups were compared with a group of patients who had never been IDUs. Factors related to ART uptake and virological endpoints were analysed using logistic generalized estimating equations. RESULTS: We followed 8660 participants for 48 477 person-years; 29.7% were in the IDU HIV transmission group. The likelihood of being on ART at biannual visits was lower among individuals in OSTPs with concomitant injecting drug use [odds ratio (OR) 0.79; 95% confidence interval (CI) 0.71-0.89] and current IDUs (OR 0.80; 95% CI 0.67-0.96), compared with those who had never been IDUs (reference), abstinent former IDUs (OR 1.13; 95% CI 1.02-1.25) and individuals in OSTPs without injecting drug use (OR 1.18; 95% CI 1.06-1.31). The likelihood of suppressed viral replication on ART was similar among those who had never been IDUs, abstinent former IDUs and individuals in an OSTP without injecting drug use, and lower among those in OSTPs with concomitant drug use (OR 0.82; 95% CI 0.72-0.93) and current IDUs (OR 0.81; 0.65-1.00). Adherence to ART was decreased among persons with continued injecting drug use, and correlated with virological outcome. CONCLUSIONS: Uptake of and virological response to ART were improved among abstinent former IDUs and persons in OSTPs without concomitant injecting drug use, compared with persons with continued injecting drug use.