Extra‐pair paternity commonly occurs in many socially monogamous animal species, yet the reasons why females mate with males outside the social pair bond remain poorly understood. Because sex steroids mediate aggressive and sexual behaviors that peak prior to egg laying in female birds, we tested whether they also influence the rate of extra‐pair paternity in nests of female tree swallows (Tachycineta bicolor). In one treatment, we experimentally elevated testosterone (T) using implants containing exogenous T, and in another treatment, we blocked the estrogenic and androgenic actions of T using implants containing 1,4,6‐androstatrien‐3,17‐dione in combination with flutamide (ATD+F). Females with empty implants served as controls. Nests of females treated with T and those with ATD+F were less likely to contain extra‐pair offspring and had a lower proportion of extra‐pair offspring, compared to control females. Treating females with T also delayed clutch initiation dates and disrupted incubation behavior, as found in previous studies, but clutch sizes of T females did not differ from controls. Females treated with ATD+F tended to lay larger clutches than control and T‐treated females, which may be due to their clutch sizes not declining with later initiation dates as found in the T and control treatments; however, after controlling for brood size, ATD+F females produced nestlings that were lighter at day 16 than control females. Although the effect of T on extra‐pair paternity that we observed in tree swallows is consistent with previous studies in female birds, our results demonstrate that blocking the estrogenic and/or androgenic actions of T during pre‐breeding also lowers extra‐pair paternity. Overall, our study suggests that extra‐pair paternity in tree swallows is mediated by sex steroids of females.