Mercury and the Moon both have tenuous atmospheres that contain atomic sodium and potassium. These chemicals must be continuously resupplied, as neither body can retain the atoms for more than a few hours. The mechanisms proposed to explain the resupply include sputtering of the surface by the solar wind, micrometeorite impacts, thermal desorption and photon-stimulated desorption. But there are few data and no general agreement about which processes dominate. Here we report laboratory studies of photon-stimulated desorption of sodium from surfaces that simulate lunar silicates. We find that bombardment of such surfaces at temperatures of approximately 250 K by ultraviolet photons (wavelength lambda < 300 nm) causes very efficient desorption of sodium atoms, induced by electronic excitations rather than by thermal processes or momentum transfer. The flux at the lunar surface of ultraviolet photons from the Sun is sufficient to ensure that photon-stimulated desorption of sodium contributes substantially to the Moon's atmosphere. On Mercury, solar heating of the surface implies that thermal desorption will also be an important source of atmospheric sodium.