Several extensions to the Standard Model of particle physics, including light dark matter candidates and unification theories predict deviations from Newton’s law of gravitation. For macroscopic distances, the inverse-square law of gravitation is well confirmed by astrophysical observations and laboratory experiments. At micrometer and shorter length scales, however, even the state-of-the-art constraints on deviations from gravitational interaction, whether provided by neutron scattering or precise measurements of forces between macroscopic bodies, are currently many orders of magnitude larger than gravity itself. Here we show that precision spectroscopy of weakly bound molecules can be used to constrain non-Newtonian interactions between atoms. A proof-of-principle demonstration using recent data from photoassociation spectroscopy of weakly bound Yb2 molecules yields constraints on these new interactions that are already close to state-of-the-art neutron scattering experiments. At the same time, with the development of the recently proposed optical molecular clocks, the neutron scattering constraints could be surpassed by at least two orders of magnitude.