Sex ratios in social insects have become a general model for tests of inclusive fitness theory, sex ratio theory and parent–offspring conflict. In populations of Formica exsecta with multiple queens per colony, sex ratios vary greatly among colonies and the dry-weight sex ratio is extremely male-biased, with 89% of the colonies producing males but no gynes (reproductive females). Here we test the queen-replenishment hypothesis, which was proposed to explain sex ratio specialization in this and other highly polygynous ants (i.e. those with many queens per nest). This hypothesis proposes that, in such ants, colonies produce gynes to recruit them back into the colony when the number of resident queens falls below a given threshold limiting colony productivity or survival. We tested predictions of the queen-replenishment hypothesis by following F. exsecta colonies across two breeding seasons and relating the change in effective queen number with changes in sex ratio, colony size and brood production. As predicted by the queen-replenishment hypothesis, we found that colonies that specialized in producing females increased their effective queen number and were significantly more likely to specialize in male production the following year. The switch to male production also coincided with a drop in productivity per queen as predicted. However, adoption of new queens did not result in a significant increase in total colony productivity the following year. We suggest that this is because queen production comes at the expense of worker production and thus queen production leads to resource limitation the following year, buffering the effect of greater queen number on total productivity.