Background The duration of protection against the omicron (B.1.1.529) variant for current COVID-19 vaccines is not well characterised. Vaccine-specific estimates are especially needed. We aimed to evaluate the effectiveness and durability of two and three doses of the BNT162b2 (Pfizer–BioNTech) mRNA vaccine against hospital and emergency department admissions due to the delta (B.1.617.2) and omicron variants. Methods In this case–control study with a test-negative design, we analysed electronic health records of members of Kaiser Permanente Southern California (KPSC), a large integrated health system in California, USA, from Dec 1, 2021, to Feb 6, 2022. Vaccine effectiveness was calculated in KPSC patients aged 18 years and older admitted to hospital or an emergency department (without a subsequent hospital admission) with a diagnosis of acute respiratory infection and tested for SARS-CoV-2 via PCR. Adjusted vaccine effectiveness was estimated with odds ratios from adjusted logistic regression models. This study is registered with ClinicalTrials.gov (NCT04848584). Findings Analyses were done for 11 123 hospital or emergency department admissions. In adjusted analyses, effectiveness of two doses of the BNT162b2 vaccine against the omicron variant was 41% (95% CI 21–55) against hospital admission and 31% (16–43) against emergency department admission at 9 months or longer after the second dose. After three doses, effectiveness of BNT162b2 against hospital admission due to the omicron variant was 85% (95% CI 80–89) at less than 3 months but fell to 55% (28–71) at 3 months or longer, although confidence intervals were wide for the latter estimate. Against emergency department admission, the effectiveness of three doses of BNT162b2 against the omicron variant was 77% (72–81) at less than 3 months but fell to 53% (36–66) at 3 months or longer. Trends in waning against SARS-CoV-2 outcomes due to the delta variant were generally similar, but with higher effectiveness estimates at each timepoint than those seen for the omicron variant. Interpretation Three doses of BNT162b2 conferred high protection against hospital and emergency department admission due to both the delta and omicron variants in the first 3 months after vaccination. However, 3 months after receipt of a third dose, waning was apparent against SARS-CoV-2 outcomes due to the omicron variant, including hospital admission. Additional doses of current, adapted, or novel COVD-19 vaccines might be needed to maintain high levels of protection against subsequent waves of SARS-CoV-2 caused by the omicron variant or future variants with similar escape potential. Funding Pfizer.