Empirical studies show that female workers are under-represented in highest hierarchical positions of companies, which is known as the glass-ceiling effect. In this study we investigate the relationship between social networks and the glass-ceiling effect. Specifically, we develop an equilibrium search and matching model where job ladders consist of three hierarchical levels and social networks are generated endogenously. Male and female workers move up in the hierarchical ladder via job-to-job transitions between firms and internal promotions within firms. They also accumulate experience which is a necessary requirement for applying to jobs in the highest hierarchical level. Open vacancies can be filled by formal matching of applicants to jobs or by referrals, which implies that senior workers recommend their social contacts for the job. Social networks exhibit gender homophily, which reflects the fact that social ties are more likely to be formed between workers of the same gender. In a setting when female workers are the minority, there are too few female contacts in the social networks of their male colleagues. This disadvantage implies that female workers are refereed less often for the jobs and under-represented in senior hierarchical positions of firms. We show that referrals via homophilous social networks can explain part of the total wage gap stemming from the glass-ceiling effect in Germany (6.4%). This mechanism is amplified by more hierarchical firm structures, stronger clustering of social networks, and earlier promotion times.