Social insect sex and caste ratios are well-studied targets of evolutionary conflicts, but the heritable factors affecting these traits remain unknown. To elucidate these factors, we carried out a short-term artificial selection study on female caste ratio in the ant Monomorium pharaonis. Across three generations of bidirectional selection, we observed no response for caste ratio, but sex ratios rapidly became more female-biased in the two replicate high selection lines and less female-biased in the two replicate low selection lines. We hypothesized that this rapid divergence for sex ratio was caused by changes in the frequency of infection by the heritable bacterial endosymbiont Wolbachia, because the initial breeding stock varied for Wolbachia infection, and Wolbachia is known to cause female-biased sex ratios in other insects. Consistent with this hypothesis, the proportions of Wolbachia-infected colonies in the selection lines changed rapidly, mirroring the sex ratio changes. Moreover, the estimated effect of Wolbachia on sex ratio (~13% female bias) was similar in colonies before and during artificial selection, indicating that this Wolbachia effect is likely independent of the effects of artificial selection on other heritable factors. Our study provides evidence for the first case of endosymbiont sex ratio manipulation in a social insect.