Background: People living with human immunodeficiency virus (HIV; PLWH) have a markedly elevated anal cancer risk, largely due to loss of immunoregulatory control of oncogenic human papillomavirus infection. To better understand anal cancer development and prevention, we determined whether recent, past, cumulative, or nadir/peak CD4+ T-cell count (CD4) and/or HIV-1 RNA level (HIV RNA) best predict anal cancer risk. Methods: We studied 102 777 PLWH during 1996-2014 from 21 cohorts participating in the North American AIDS Cohort Collaboration on Research and Design. Using demographics-adjusted, cohort-stratified Cox models, we assessed associations between anal cancer risk and various time-updated CD4 and HIV RNA measures, including cumulative and nadir/peak measures during prespecified moving time windows. We compared models using the Akaike information criterion. Results: Cumulative and nadir/peak CD4 or HIV RNA measures from approximately 8.5 to 4.5 years in the past were generally better predictors for anal cancer risk than their corresponding more recent measures. However, the best model included CD4 nadir (ie, the lowest CD4) from approximately 8.5 years to 6 months in the past (hazard ratio [HR] for <50 vs ≥500 cells/μL, 13.4; 95% confidence interval [CI], 3.5-51.0) and proportion of time CD4 <200 cells/μL from approximately 8.5 to 4.5 years in the past (a cumulative measure; HR for 100% vs 0%, 3.1; 95% CI, 1.5-6.6). Conclusions: Our results are consistent with anal cancer promotion by severe, prolonged HIV-induced immunosuppression. Nadir and cumulative CD4 may represent useful markers for identifying PLWH at higher anal cancer risk.