Little is known about risk factors for progression of high-grade anal intraepithelial neoplasia (AIN) to anal squamous cell carcinoma (ASCC). In this large, population-based study, we assess the role of factors related to immune status for the risk of ASCC among individuals from the general population with a diagnosis of AIN3. Individuals diagnosed with AIN3 during 1985-2016 were identified in the Danish Pathology Registry and followed for subsequent development of ASCC. The study population was linked to the National Patient Registry, the Danish Prescription Registry and the Danish HIV Cohort Study for information on autoimmune disease, genital warts and HIV status. To study the progression rate, Cox regression models with hazard ratios (HR) and 95% confidence intervals (CI) were applied with time since AIN3 as the underlying time scale and with adjustment for age at AIN3 diagnosis, year of AIN3 diagnosis and sex. The study population comprised 1222 individuals with AIN3 contributing 12 824 person-years of follow-up. Ninety-seven individuals (7.9%) developed ASCC. Individuals registered with an autoimmune disease or genital warts before and/or after the AIN3 diagnosis had an increased rate of progression to ASCC compared to individuals without these conditions. People living with HIV had a higher progression rate than HIV-negative individuals (HR = 4.25; 95% CI: 1.87-9.65) with the highest progression rate among those with CD4 count ≤200 cells/μL. These associations may be caused by an interplay between HPV infection and immunosuppression.