Résumé : Background: Elvitegravir is a once daily inhibitor of HIV-1 integrase boosted by ritonavir. We aimed to compare the efficacy and safety of elvitegravir with raltegravir, another HIV-1 integrase inhibitor, in patients in whom previous antiretroviral treatment failed. Methods: We conducted a randomised, double-blind, double-dummy, phase 3 study at 234 sites in 13 countries. Eligible patients had plasma HIV RNA of 1000 copies per mL or greater, any CD4 cell count, and resistance to or 6 months' experience with at least two classes of antiretroviral drugs. They received an open-label background regimen of a fully active, ritonavir-boosted protease inhibitor and a second agent. We randomly allocated patients (1:1) by computer with a block size of four to receive either elvitegravir 150 mg once daily (n=361; 85 mg dose if given with atazanavir, or lopinavir with ritonavir) or raltegravir 400 mg twice daily (n=363). Placebo tablets were given to mask the difference in daily dosing. The primary endpoint was achievement and maintenance of virological response (HIV RNA <50 copies per mL) through week 48. Non-inferiority was prespecified with a margin of 10%. We did a modified intention-to-treat analysis. This study is registered with ClinicalTrials.gov, number NCT00708162. Findings: Ten patients allocated elvitegravir and 12 assigned raltegravir were excluded from the analysis (either for protocol violations or because they did not receive treatment). 207 (59%) of 351 patients allocated elvitegravir achieved virological response compared with 203 (58%) of 351 assigned raltegravir (treatment difference 1·1%, 95% CI -6·0 to 8·2), meeting the criterion for non-inferiority (p=0·001). Three patients allocated elvitegravir had serious adverse events related to study drugs compared with seven assigned raltegravir; two and eight patients died, respectively. More individuals assigned elvitegravir reported diarrhoea up to week 48 (p=0·023), and more patients assigned raltegravir had grade 3 or 4 rises in alanine aminotransferase (p=0·020) or aspartate aminotransferase (p=0·009). Interpretation: Elvitegravir used in combination with a ritonavir-boosted protease inhibitor in treatment-experienced patients has similar efficacy and safety to raltegravir. Since elvitegravir can be given once a day compared with twice a day for raltegravir, elvitegravir might improve patients' adherence. Funding: Gilead Sciences. © 2012 Elsevier Ltd.