The thermal movement of an atomic force microscope (AFM) tip is used to reconstruct the tip-surface interaction potential. If a tip is brought into the vicinity of a surface, its movement is governed by the sum of the harmonic cantilever potential and the tip-surface interaction potential. By simulation of the movement of a tip in a model potential, it was demonstrated that a potential can be reconstructed from the probability distribution of the tip position. By application of the reconstruction technique to an experimentally obtained distribution function, it was demonstrated that the method is very sensitive to drifts in the AFM setup. In addition to this, the tip-surface interaction potential cannot be derived because the cantilever potential adds an undetermined term to the measured potential. By use of the force-distance curves to carefully control the movement of the cantilever, the position of the cantilever is determined at all times. This enables the determination of the tip-surface interaction potential. Because a force-distance curve has an internal calibration of the position of the cantilever potential, individual curves can be averaged to improve the accuracy of the method. The novel method is tested on a model system of a Si3N4 tip that interacts with mica. In 100 mM KCl buffer, the tip-surface interaction potential can be determined with an accuracy below the thermal energy kbT. The interaction potential has a minimum of 22 kbT because of the combination of van der Waals attraction and Born repulsion. At 3 mM KCl, the tip-surface interaction is dominated by the electrostatic interaction.