Muslim societies have been reshaped in recent decades by an Islamic revival. We document a contemporaneous decline in social mobility among educated youth in Egypt, the epicentre of the movement in the Arab world. We then develop a model to show how an unexpected decline in social mobility combined with inequality can produce a religious revival led by the educated middle class. The principal idea is that religion helps individuals to cope with unfulfilled aspirations by adjusting their expectations-based reference point. By raising aspirations, economic development may make societies more prone to religious revivals.