Maternal hormones are important mediators of prenatal maternal effects. Although many experimental studies have demonstrated their potency in shaping offspring phenotypes, we know remarkably little about their adaptive value. Using long-term data on a wild collared flycatcher (Ficedula albicollis) population, we show that natural selection acts in opposite ways on two maternally derived androgens, yolk androstenedione (A4) and yolk testosterone (T). High yolk A4 concentrations are associated with higher fitness, whereas high yolk T concentrations are associated with lower fitness. Natural selection thus favours females that produce eggs with high A4 and low T concentrations. Importantly, however, there exists a positive (non-genetic) correlation between A4 and T, which suggests that females are limited in their ability to reach this adaptive optimum. Thereby, these results provide strong evidence for an adaptive value of differential maternal androgen deposition, and a mechanistic explanation for the maintenance of variation in maternal investment in the wild.