Homelessness is prevalent among HIV-infected injection drug users (IDU) and may adversely affect access and adherence to antiretroviral therapy (ART). There are limited descriptions of the effect of homelessness on adherence to ART in long-term cohorts of HIV-infected IDU. We used data from a community-recruited prospective cohort of HIV-infected IDU, including comprehensive ART dispensation records, in a setting where HIV care is free. We examined the relationship between the homelessness measured longitudinally, and the odds of ≥95% adherence to ART using generalized estimating equations logistic regression modeling adjusting for sociodemographics, drug use, and clinical variables. Between May 1996 and September 2008, 545 HIV-infected IDU were recruited and eligible for the present study. The median follow-up duration was 23.8 months (IQR 8.5-91.6 months) contributing 2,197 person-years of follow-up. At baseline, homeless participants were slightly younger (35.8 vs. 37.9 years, p = 0.01) and more likely to inject heroin at least daily (37.1% vs. 24.6%. p = 0.004) than participants who had housing. The multivariate model revealed that homelessness (adjusted odds ratio [AOR] 0.66; 95% CI: 0.53-0.84) and frequent heroin use (AOR 0.40; 95% CI: 0.30-0.53) were significantly and negatively associated with ART adherence, whereas methadone maintenance was positively associated (AOR 2.33; 95% CI: 1.86-2.92). Sub-optimal ART adherence was associated with homelessness and daily injection heroin use among HIV-infected IDU. Given the survival benefit of ART, it is critical to develop and evaluate innovative strategies such as supportive housing and methadone maintenance to address these risk factors to improve adherence.