The alkali-atom density measurement method based on light absorption is highly suitable for a spin-exchange relaxationfree (SERF) atomic magnetometer because of its high-precision measurement and complete nonmagnetic interference. In this study, the optical rotation angle detection system based on polarization balance detection is utilized to realize the alkali-atom density real-time measurement without affecting magnetic field measurement. We discovered that there exists an optimal frequency detuning of the probe light, which offers the highest sensitivity in alkali-atom density measurement and the lowest susceptibility to temperature fluctuations in terms of the scale factor. In contrast to conventional light absorption measurements based on pump light, this method demonstrated a threefold improvement in alkali-atom density measurement sensitivity while remaining immune to ambient magnetic fields and incident light intensity fluctuations. Furthermore, we utilized this method to achieve closed-loop temperature control with an accuracy of 0.04°C.