OBJECTIVES: To determine the prevalence and risk factors for anal human papillomavirus (HPV) infection in community-based cohorts of homosexual men in Sydney, Australia. METHODS: A cross-sectional study in consecutively presenting participants in the positive Health and Health in Men cohorts in 2005. HPV testing was performed on anal PreservCyt specimens collected from 316 homosexual men (193 HIV-negative, 123 HIV-positive) using the Digene Hybrid Capture 2 (HC-2) assay for detection of low-risk (LR) and high-risk (HR) genotypes. HPV genotype testing was also performed on a subset of 133 men (93 HIV-negative, 36 HIV-positive) using Roche Linear Array (LA) assay. RESULTS: HC-2 detected HPV infection in 79% of men (LR 55%, HR 69%). HIV-positive men were more likely than HIV-negative men to have LR-HPV (OR 3.5, 95% CI 2.1 to 5.7) and HR-HPV (OR 5.5, 95% CI 3.0 to 10.2). LA detected HPV infection in 95% of men (LR 85%, HR 77%). HIV-positive men had a mean of 7.1 HPV types compared to 4.2 in HIV-negative men; the difference was significant for both LR-HPV (p<0.001) and HR-HPV (p<0.001). HPV-16 was detected in 36% of HIV-positive and 27% of HIV-negative men. There was no consistent trend in HPV prevalence with increasing age. HR-HPV detection was associated with anal bleeding for HIV-positive men and anal warts for HIV-negative men. CONCLUSIONS: Anal HPV infection was nearly universal in this community-based sample of homosexual men. A wide variety of HPV genotypes were detected, and co-infection with multiple genotypes was common. Anal HPV infection is more prevalent and more diverse in HIV-positive than HIV-negative homosexual men.