The nonlinear Zeeman effect can induce splittings and asymmetries of magnetic-resonance lines in the geophysical magnetic-field range. We demonstrate a scheme to suppress the nonlinear Zeeman effect all optically based on spin locking. Spin locking is achieved with an effective oscillating magnetic field provided by the AC Stark-shift of an intensity-modulated and polarization-modulated laser beam. This results in the collapse of the multi-component asymmetric magnetic-resonance line with about 100 Hz width in the Earth-field range into a peak with a central component width of 25Hz. The technique is expected to be broadly applicable in practical magnetometry, potentially boosting the sensitivity and accuracy of Earth-surveying magnetometers by increasing the magnetic-resonance amplitude and decreasing its width. Advantage of an all-optical approach is the absence of cross-talk between nearby sensors when these are used in a gradiometric or in an array arrangement.