In sexual populations, gene-flow between niches is predicted to have differential consequences on local adaptation contingent upon the nature of trade-offs underlying local adaptation. Sex retards local adaptation if antagonistic pleiotropy underlies trade-offs, but facilitates adaptation if mutation accumulation underlies trade-offs. We evaluate the effect of sex in heterogeneous environments by manipulating gene-flow between two niches in sexual and asexual populations using steady-state microcosm experiments with yeast. We find that only sex in the presence of gene-flow promotes simultaneous local adaptation to different niches, presumably as this exposes mutations neutrally accrued in alternate niches to selection. This finding aligns with work showing mutation accumulation underlies trade-offs to local adaptation in asexual microbes, and with inferences of divergence in the presence of gene-flow in natural sexual populations. This experiment shows that sex may be of benefit in heterogeneous environments, and thus helps explain why sex has been maintained more generally.