We analyse impacts of the rising labor force participation of women on the gender wage gap. We formulate and structurally estimate an equilibrium model of the labor market in which the elasticity of substitution between male and female labor is allowed to vary depending on the task content of occupations. We find that the elasticity of substitution is higher in high-paying occupations that are intensive in abstract and analytical tasks than in low-paying manual and routine occupations. Consistent with this we find a narrowing of the gender wage gap towards the upper end of the wage distribution and an increase in the gender wage gap at the low end. Demand side trends favoured women and this attenuated the supply-driven downward pressure on women's wages in low-paying occupations, and fully counteracted it in high-paying occupations. The paper contributes new evidence on the distribution of the gender wage gaps, and contributes to a wider literature on technological change, occupational sorting, wage inequality and polarization.