Objective: To identify prognostic factors associated with survival time in HIV-infected patients with advanced immunodeficiency. Design: Prospective cohort study. Participants: A total of 1284 HIV-infected patients with serial CD4 count measurements and at least one CD4 cell count less than or equal to 50 x 10(6)/l (CD4 less than or equal to 50). Main outcome measure: Survival from initial CD4 cell count less than or equal to 50 x 10(6)/l. Results: The median survival from initial CD4 less than or equal to 50 x 10(6)/l was 17.1 months. The risk of death increased by 2% [95% confidence interval (CI), 1-3] for each year of age, by 10% (95% Cl, 3-16) for each 10 x 10(6)/l decrease in CD4 count, and by 14% (95% Cl, 9-18) for each 1 g/dl decrease in haemoglobin level. Compared to AIDS-free patients with CD4 less than or equal to 50 x 10(6) cells/l, the risk of dying was 1.5 fold (95% Cl, 1.2-1.9) that of patients who had an AIDS diagnosis for fewer than 3 months prior to CD4 less than or equal to 50, 1.8-fold for patients with an AIDS diagnosis for 4-11 months prior to CD4 less than or equal to 50, and twice that of patients with AIDS for greater than or equal to 12 months prior to CD4 less than or equal to 50. The risk of dying for patients whose rate of CD4 cell decline was > 40 x 10(6)/l per 6 months was 1.7-fold (95% Cl, 1.3-2.3) that of patients with an average CD4 cell loss < 40 x 10(6)/l per 6 months, after adjusting for age, haemoglobin and duration of AIDS prior to CD4 less than or equal to 50 x 10(6) cells/l. A prognostic score was developed from the final multivariate model, based on age at CD4 less than or equal to 50, haemoglobin at CD4 less than or equal to 50, duration of AIDS and rate of CD4 decline prior to CD4 less than or equal to 50. Conclusions: Routinely available clinical and laboratory data including haemoglobin level, rate of CD4 decline and duration of AIDS can be readily translated into a prognostic score and then used to predict the survival experience of an HIV-infected patient with advanced immunodeficiency.