Mechanical drift between an atomic force microscope (AFM) tip and sample is a longstanding problem that limits tip-sample stability, registration, and the signal-to-noise ratio during imaging. We demonstrate a robust solution to drift that enables novel precision measurements, especially of biological macromolecules in physiologically relevant conditions. Our strategy - inspired by precision optical trapping microscopy - is to actively stabilize both the tip and the sample using locally generated optical signals. In particular, we scatter a laser off the apex of commercial AFM tips and use the scattered light to locally measure and thereby actively control the tip's three-dimensional position above a sample surface with atomic precision in ambient conditions. With this enhanced stability, we overcome the traditional need to scan rapidly while imaging and achieve a 5-fold increase in the image signal-to-noise ratio. Finally, we demonstrate atomic-scale (similar to 100 pm) tip-sample stability and registration over tens of minutes with a series of AFM images. The stabilization technique requires low laser power (<1 mW), imparts a minimal perturbation upon the cantilever, and is independent of the tip-sample interaction. This work extends atomic-scale tip-sample control, previously restricted to cryogenic temperatures and ultrahigh vacuum, to a wide range of perturbative operating environments.