Background: Human papillomavirus (HPV)-associated anogenital malignancies occur frequently in patients with human immunodeficiency virus (HIV) infection and the acquired immunodeficiency syndrome (AIDS). The purpose of our study was to determine if the high frequency of these cancers is due to lifestyle factors associated with both HPV and HIV infections or to immunosuppression following HIV infection. Methods: We studied invasive and in situ HPV-associated cancers among 309 365 U.S. patients with HIV infection/AIDS (257 605 males and 51 760 females) from 5 years before the date of AIDS onset to 5 years after this date. Sex-, race-, and age-standardized ratios of observed-to-expected cancers served as measures of relative risk (RR). Trend tests were used to evaluate changes in the RRs during the 10 years spanning AIDS onset. All statistical tests were two-sided. Results: All HPV-associated cancers in AIDS patients occurred in statistically significant excess compared with the expected numbers of cancers. For in situ cancers, overall risks were significantly increased for cervical (RR = 4.6; 95% confidence interval [CI] = 4.3–5.0), vulvar/vaginal (RR = 3.9; 95% CI = 2.0–7.0), anal (in females, RR = 7.8 [95% CI = 0.2–43.6]; in males, RR = 60.1 [95% CI = 49.2–72.7]), and penile (RR = 6.9; 95% CI = 4.2–10.6) cancers, and RRs increased during the 10 years spanning AIDS onset for carcinomas in situ of the cervix (P for trend <.001), vulva/vagina (P for trend = .04), and penis (P for trend = .04). For invasive cancers, overall risks were significantly increased for cervical (RR = 5.4; 95% CI = 3.9–7.2), vulvar/vaginal (RR = 5.8; 95% CI = 3.0–10.2), and anal (RR = 6.8; 95% CI = 2.7–14.0) cancers in females and for anal (RR = 37.9; 95% CI = 33.0–43.4), penile (RR = 3.7; 95% CI = 2.0–6.2), tonsillar (RR = 2.6; 95% CI = 1.8–3.8), and conjunctival (RR = 14.6; 95% CI = 5.8–30.0) cancers in males. However, RRs for invasive cancers changed little during the 10 years spanning AIDS onset. Conclusions: HPV-associated malignancies occur at increased rates in persons with HIV/AIDS. Increasing RRs for in situ cancers to and beyond the time of AIDS onset may reflect the gradual loss of control over HPV-infected keratinocytes with advancing immunosuppression. However, the lack of a similar increase for invasive HPV-associated cancers suggests that late-stage cancer invasion is not greatly influenced by immune status.