OBJECTIVE: To estimate the effectiveness of mRNA vaccines against moderate and severe covid-19 in adults by time since second, third, or fourth doses, and by age and immunocompromised status. DESIGN: Test negative case-control study. SETTING: Hospitals, emergency departments, and urgent care clinics in 10 US states, 17 January 2021 to 12 July 2022. PARTICIPANTS: 893 461 adults (≥18 years) admitted to one of 261 hospitals or to one of 272 emergency department or 119 urgent care centers for covid-like illness tested for SARS-CoV-2. MAIN OUTCOME MEASURES: The main outcome was waning of vaccine effectiveness with BNT162b2 (Pfizer-BioNTech) or mRNA-1273 (Moderna) vaccine during the omicron and delta periods, and the period before delta was dominant using logistic regression conditioned on calendar week and geographic area while adjusting for age, race, ethnicity, local virus circulation, immunocompromised status, and likelihood of being vaccinated. RESULTS: 45 903 people admitted to hospital with covid-19 (cases) were compared with 213 103 people with covid-like illness who tested negative for SARS-CoV-2 (controls), and 103 287 people admitted to emergency department or urgent care with covid-19 (cases) were compared with 531 168 people with covid-like illness who tested negative for SARS-CoV-2. In the omicron period, vaccine effectiveness against covid-19 requiring admission to hospital was 89% (95% confidence interval 88% to 90%) within two months after dose 3 but waned to 66% (63% to 68%) by four to five months. Vaccine effectiveness of three doses against emergency department or urgent care visits was 83% (82% to 84%) initially but waned to 46% (44% to 49%) by four to five months. Waning was evident in all subgroups, including young adults and individuals who were not immunocompromised; although waning was morein people who were immunocompromised. Vaccine effectiveness increased among most groups after a fourth dose in whom this booster was recommended. CONCLUSIONS: Effectiveness of mRNA vaccines against moderate and severe covid-19 waned with time after vaccination. The findings support recommendations for a booster dose after a primary series and consideration of additional booster doses.