Covid-19 and the resulting lockdowns affected various aspects of peopleâ€™s lives, including their mental health. Recent literature suggests a causal link between religiosity and mental health. Using data from an online survey, we investigate the role of religiosity in mediating the effect of Covid-19 on mental health. From Februaryâ€“March 2021, we conducted online surveys in the USA among 5178 individuals. These surveys elicited responses on (i) the incidence of Covid-19 infections among the respondents or their immediate social networks, (ii) religious beliefs and practices, and (iii) mental health. Employing the CESD scale, which tests for depression in clinical settings, we find that while the incidence of a Covid-19 infection is associated with significantly worse mental health, this negative association is significantly smaller for religious people. We posit that the mental health benefits of being religious emanate from the ability to participate in religious activities. Indeed, the ameliorative effect of religion is higher in low-strictness counties, where Covid-related lockdown policies were enforced less strictly, but not in high-strictness counties. We also document an increased uptake of online religious services, a substitute for in-person religious gatherings during the lockdown. Crucially, the ability to attend online religious services weakens the association between Covid-19 and worse mental health.