Despite much research over the past 30 years, there is still little general understanding of how the outcomes of interactions vary along environmental gradients, particularly at large geographic scales. A simple expectation is that decreasing environmental quality should reduce densities of competitors and hence the effects of competition should weaken in poorer environments. A counterintuitive consequence is that associations between densities of competitors might change from negative to positive as environments decrease in quality. Here we test these predictions in a set of vascular plant communities where perennial species share space and resources with less competitive annuals. We surveyed nine gray dune communities annually for 5 years along a cross-European latitudinal gradient of habitat quality. We find that densities of annual and perennial species are negatively correlated at the high-quality end of the gradient, while at the low-quality end, guild densities are uncorrelated or positively correlated, consistent with a weakening of competition linked to increasing environmental limitations. Our results suggest that even simple interactions can give rise to nonobvious changes in species associations along environmental gradients. They highlight that understanding the outcome of species interactions may require explicit characterization of their changing intensity with environmental quality and that the factors limiting species' codistribution can vary along environmental gradients.