The probability of being depressed increases dramatically during adolescence and is linked to a range of adverse outcomes. Many studies show a correlation between religiosity and mental health, yet the question remains whether the link is causal. The key issue is selection into religiosity. We exploit plausibly random variation in adolescents' peers to shift religiosity independently of individual-level unobservables that might affect depression, and show conditions such that an individual effect of religiosity is separated from the potential direct effect of peers. Using a nationally representative sample of adolescents in the US, we find robust effects of religiosity on depression, that are particularly strong for the most depressed. We demonstrate that these effects are not driven by the school social context. We find that religiosity buffers against stressors, possibly through improved psychological resources and religion-based support structures. This has implications especially for effective mental health policy.