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 other individual-level unobservables that might affect depression. 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. These effects are not a result of social context. Instead, we find that religiosity buffers against stressors, possibly through improved social and psychological resources. This has implications especially for effective mental health policy.