Microwave measurement technology based on Rydberg atoms has attracted extensive attention due to its advantages of broad bandwidth, small-size probe, and high sensitivity. Automatic frequency stabilization of laser systems is a key link to improve the automation level and response speed of atomic microwave measurement systems. However, most existing systems rely on manual operation to achieve laser frequency locking, and research on automatic frequency stabilization of dual-wavelength lasers for atomic microwave measurement is still insufficient. This paper proposes a peak recognition algorithm based on spectral peak distance, which realizes accurate positioning of target peaks in saturated absorption spectroscopy and electromagnetically induced transparency spectroscopy. Using these peaks as frequency references, we directly drive the automatic frequency stabilization closed loop of lasers, thereby completing fully automatic locking of both probe light and coupling light frequencies. The measurement results show that the automatic frequency locking takes 5.55 seconds for the probe light and 13.9 seconds for the coupling light. The second-order frequency stability of the probe light reaches the 10
-10 level, with a minimum Allan deviation of 1.1×10
-10 at an averaging time of 32 seconds. The second-order frequency stability of the coupling light is also at the level, with a minimum Allan deviation of 1.1×10
-10 at an averaging time of 16 seconds. During the test period, the automatically locked probe light and coupling light exhibit excellent frequency stability, whose stability indicators meet the typical operational requirements of Rydberg atom microwave measurement systems, verifying the reliability of the proposed spectral peak distance-based peak recognition algorithm.