Background Treatment strategies for patients in whom HIV replication is not suppressed after exposure to several drug classes remain unclear. We aimed to assess the inter-relations between viral load, CD4-cell count, and clinical outcome in patients who had experienced three-class virological failure. Methods We undertook collaborative joint analysis of 13 HIV cohorts from Europe, North America, and Australia, involving patients who had had three-class virological failure (viral load >1000 copies per mL for >4 months). Regression analyses were used to quantify the associations between CD4-cell-count slope, HIV-1 RNA concentration, treatment information, and demographic characteristics. Predictors of death were analysed by Cox's proportional-hazards models. Findings 2488 patients were included. 2118 (85%) had started antiretroviral therapy with single or dual therapy. During 5015 person-years of follow-up, 276 patients died (mortality rate 5·5 per 100 person-years; 3-year mortality risk 15·3% (95% CI 13·5-17·3). Risk of death was strongly influenced by the latest CD4-cell count with a relative hazard of 15·8 (95% CI 9·28-27·0) for counts below 50 cells per μL versus above 200 cells per μL. The latest viral load did not independently predict death. For any given viral load, patients on treatment had more favourable CD4-cell-count slopes than those off treatment. For patients on treatment and with stable viral load, CD4-cell counts tended to be increasing at times when the current viral load was below 10 000 copies per mL or 1·5 log10copies per mL below off-treatment values. Interpretation In patients for whom viral-load suppression to below the level of detection is not possible, achievement and maintenance of a CD4-cell count above 200 per μL becomes the primary aim. Treatment regimens that maintain the viral load below 10 000 copies per mL or at least provide 1·5 log10copies per mL suppression below the off-treatment value do not seem to be associated with appreciable CD4-cell-count decline.