While network studies have shown that preferences of both Muslim and non-Muslim adolescents contribute to religious friendship segregation, it is unclear whether these preferences are ubiquitous or dependent on local context. Examining large-scale longitudinal friendship network data of adolescents in Germany, we investigate how the proportion of Muslim classmates affects friendship preferences of Muslims and non-Muslims. We find that Muslim youth favor Muslims over non-Muslims to a similar degree at all proportions of Muslim classmates. Non-Muslims’ reluctance to be friends with Muslims peaks in classrooms in which about half of the students are Muslims but is otherwise lower or absent.