Anal infection with high-risk human papillomavirus (HPV) genotypes 16 and 18 and anal cancer are overrepresented in men who have sex with men (MSM). This study investigated HPV prevalence in young MSM before and after the implementation of a school-based quadrivalent HPV (genotypes 6, 11, 16, and 18) vaccination programme for boys in Australia in 2013. In this repeated cross-sectional study, MSM aged 16-20 years were recruited from two successive birth cohorts via sexual health clinics and the community in Melbourne, Australia. The first cohort was before the implementation of gender-neutral vaccination (HYPER1 study, done in 2010-12, NCT01422356), and the second was the post-vaccination cohort (HYPER2 study, done in 2017-18, NCT03000933). Men who self-identified as being same-sex attracted were enrolled, and those recruited via the HYPER2 study had to be resident in Australia since 2013 to ensure eligibility. Study procedures were done in the Melbourne Sexual Health Centre. A clinician-collected anal swab and self-collected penile swab and oral rinse were tested for 28 HPV genotypes, and data on demographics and sexual health practices were collected via questionnaires. Only assessable samples were included in the analyses. We compared anatomical site-specific prevalence of HPV genotypes between cohorts by calculating the prevalence ratio, adjusting for age, circumcision, and sex with women. Herd protection was also assessed, by calculating the adjusted prevalence ratios by vaccination status. 400 MSM, 200 per cohort, were included in the study. In both cohorts, the median number of lifetime male partners was ten (IQR 5-25). The prevalence of any anal quadrivalent vaccine-preventable HPV genotype was higher in the pre-vaccination cohort (54 [28%] of 193) than in the post-vaccination cohort (14 [7%] of 193; adjusted prevalence ratio [PR] 0·24, 95% CI 0·14-0·42), largely driven by decreases in HPV6, followed by HPV11, 16, and 18. Nevertheless, there was also a significant reduction in anal HPV16 and 18 in the post-vaccination cohort from the pre-vaccination cohort (0·31, 0·14-0·68). The prevalence of any penile quadrivalent vaccine-preventable HPV genotype was also higher in the pre-vaccination cohort (21 [12%] of 177) than in the post-vaccination cohort (11 [6%] of 179; 0·48, 0·24-0·97), driven by decreases in HPV 6 and 11, but not by 16 and 18. The prevalence of any oral quadrivalent vaccine-preventable HPV genotype was higher in the pre-vaccination cohort (seven [4%] of 200) than in the post-vaccination cohort (one [1%] of 199; 0·10, 0·01-0·97); there were no cases of oral HPV6 or 11 detected in HYPER2. Comparing the pre-vaccinated cohort with the 149 confirmed vaccinated men from HYPER2 showed a reduction in any quadrivalent vaccine-preventable HPV genotype for anal (0·09, 0·03-0·25) and penile (0·18, 0·05-0·59) infection but not for oral infection (0·17, 0·03-1·08). A reduction in anal, penile, and oral quadrivalent vaccine-targeted genotypes occurred in young MSM following the implementation of a school-based gender-neutral HPV vaccination programme. The fall in anal HPV16 and 18 may lead to a reduction in the incidence of anal cancer. Merck and the Australian Government Department of Health.