Background: Opioid substitution treatment (OST) has been associated with enhanced uptake and adherence to highly active antiretroviral therapy (HAART), however standard methods for estimating the causal effect of a time-varying treatment on the mean of a repeated measures outcome may be biased when there are time-dependent variables that are simultaneously confounders of the effect of interest and are predicted by previous treatment. In our context, previous HAART adherence is hypothesized to be a time-dependent confounder for the effect of OST on future HAART adherence. Our objective was to determine the impact of OST exposure on adherence to HAART among HIV-positive opioid dependent individuals. Methodology: We selected all HAART-eligible HIV-positive individuals ever accessing opioid substitution treatment between January 1st, 1996 and March 31st 2010 within a linked population-level database for British Columbia, Canada, after meeting the criteria for HAART initiation. A marginal structural model was estimated using monthly-updated inverse probability of treatment weights (IPTW). The primary outcome measure was 95% HAART adherence, according to pharmacy refill compliance records. Exposure to OST was defined as at least 21 days of OST receipt in a calendar month. We controlled for fixed and time-varying covariates, including age, gender, ethnicity, health authority of residence, calendar year, OST history at HAART eligibility, AIDS status, CD4 and prior HAART exposure in estimated IPTW. Results: Among 12,349 HIV-positive individuals observed in BC between 1996 and 2010, 1,811 (14.7%) accessed OST, and 1,347 (10.9%) were selected for the study. Subjects were 39% female, were of median age 35 (interquartile range: 29-41) at HAART eligibility, and had a median of 6.6 years (2.8-10.9) of follow-up. During OST, individuals spent a median 55% (20%-85%) of the time on HAART, while out of OST individuals spent only 26% (7%-58%) of the time on HAART. The unadjusted odds of HAART adherence during OST exposure was 2.26 (95% confidence interval: 2.01-2.54), while the adjusted odds, estimated within the marginal structural model, was 2.17 (1.90, 2.49). Conclusions: Our results demonstrate that access to OST more than doubles the odds of HAART adherence among opioid-dependent individuals with HIV. This study informs funding decisions for OST and strategies to increase access to HAART.