The surface abundance of lithium on the Sun is 140 times less than the protosolar value, yet the temperature at the base of the surface convective zone is not hot enough to burn-and hence deplete-Li (refs 2, 3). A large range of Li abundances is observed in solar-type stars of the same age, mass and metallicity as the Sun, but such a range is theoretically difficult to understand. An earlier suggestion that Li is more depleted in stars with planets was weakened by the lack of a proper comparison sample of stars without detected planets. Here we report Li abundances for an unbiased sample of solar-analogue stars with and without detected planets. We find that the planet-bearing stars have less than one per cent of the primordial Li abundance, while about 50 per cent of the solar analogues without detected planets have on average ten times more Li. The presence of planets may increase the amount of mixing and deepen the convective zone to such an extent that the Li can be burned.