Background Data on the outcomes of COVID-19 in people living with HIV (PLHIV), specifically in relation to vaccination status, are lacking during the Omicron era. Methods This nationwide registry-based study included all resident in Sweden ≥18 years with a positive SARS-CoV-2 PCR test during January 2021–February 2023. We estimated adjusted odds ratios (adjOR) for COVID-19 hospitalisation and severe COVID-19 (ICU admission and 90-day mortality), categorised by SARS-CoV-2 vaccination status (0–1, 2, and ≥3 doses), and HIV-status. Analyses were then categorised by time periods of pre-Omicron, Omicron during public testing, and Omicron after public testing. Results 1348 PLHIV and 1 669 389 people without HIV (PWoH) were included. PLHIV were older, more migrant (65 vs. 22%) and male (59 vs. 46%). Of PLHIV, 96% were on antiretroviral treatment and 94% virally suppressed. AdjORs of COVID-19 hospitalisation were similar irrespective of HIV-status, controlled for demographics, calendar month of infection, comorbidities, and income. PLHIV were more likely to be hospitalised than PWoH during Omicron and public testing (adjOR 2.3, 95% CI 1.1–4.2), but not after public testing. The odds of severe COVID-19 were three times higher in PLHIV compared to PWoH vaccinated with 2 doses (adjOR 3.2, 95% CI 1.3–6.9), but not when vaccinated with ≥3 doses (adjOR 0.7, 95% CI 0.2–1.6). Migrant and low nadir CD4+ T-cells were associated with higher odds of hospitalisation in unvaccinated PLHIV. Conclusions This nationwide study, including mostly well-treated PLHIV, highlights the importance of vaccination with booster dose/s for effective protection against severe COVID-19 in PLHIV. KEY POINT People living with HIV compared to people without HIV did not have higher odds of COVID-19 hospitalisation irrespective of SARS-CoV-2 vaccination status (0–1 dose, 2 doses, ≥3 doses) when adjusting for known risk factors including comorbidities and socioeconomic status.