In ART programs in sub-Saharan Africa, a growing proportion of HIV-infected persons initiating first-line antiretroviral therapy (ART) have a history of prior antiretroviral drug use (PAU). We assessed the effect of PAU on the risk of pre-treatment drug resistance (PDR) and virological failure (VF) in a multicountry cohort of HIV-infected adults initiated on a standard non-nucleoside reverse transcriptase inhibitor (NNRTI)-based first-line ART. Multivariate logistic regression was used to assess the associations between PAU, PDR and VF (defined as viral load ≥400 cps/mL). Causal mediation analysis was used to assess the proportion of the effect of PAU on VF that could be eliminated by intervening on PDR. Of 2737 participants, 122 (4.5%) had a history of PAU. Participants with PAU had a 7.2-fold (95% CI 4.4-11.7) risk of carrying PDR and a 3.1-fold (95% CI 1.6-6.1) increased risk of VF, compared to antiretroviral-naïve participants. Controlling for PDR would eliminate nearly half the effect of PAU on the risk of VF. Patients with a history of PAU are at increased risk of ART failure, which is to a large extent attributable to PDR. These findings support the recent WHO recommendations for use of differentiated, non-NNRTI-based empiric first-line therapy in patients with PAU.