Using the same lens galaxies, the ratios of tangential shears for different source galaxy redshifts is equal to the ratios of their corresponding angular-diameter distances. This is the so-called shear-ratio test (SRT) and it is valid when effects induced by the intervening large-scale structure (LSS) can be neglected. The dominant LSS effect is magnification bias which, on the one hand, induces an additional shear, and on the other hand, causes a magnification of the lens population. Our objective is to quantify the magnification bias for the SRT and show an easy-to-apply mitigation strategy that does not rely on additional observations. We use ray-tracing data through the Millennium simulation to measure the influence of magnification on the SRT and test our mitigation strategy. Using the SRT as a null-test we find deviations from zero up to 10% for a flux-limited sample of lens galaxies, which is a strong function of lens redshift and the lens-source line-of-sight separation. Using our mitigation strategy we can improve the null-test by a factor of ∼100.