An optical hydrogen sulfide (H2S) sensor based on wavelength modulation spectroscopy with the second harmonic (2f) corrected by the first harmonic (1f) signal (WMS-2f/1f) is developed using a distributed feedback (DFB) laser emitting at 1.578 ¿m and a homemade gas cell with 1-m-long optical path length. The novel sensor is constructed by an electrical cabinet and an optical reflecting and receiving end. The DFB laser is employed for targeting a strong H2S line at 6 336.62 cm-1 in the fundamental absorption band of H2S. The sensor performance, including the minimum detection limit and the stability, can be improved by reducing the laser intensity drift and common mode noise by means of the WMS-2f/1f technique. The experimental results indicate that the linearity and response time of the sensor are 0.999 26 and 6 s (in concentration range of 15.2¿45.6 mg/m3), respectively. The maximum relative deviation for continuous detection (60 min) of 30.4 mg/m3 H2S is 0.48% and the minimum detection limit obtained by Allan variance is 79 ¿g/m3 with optimal integration time of 32 s. The optical H2S sensor can be applied to environmental monitoring and industrial production, and it has significance for real-time online detection in many fields.