In a quantum key distribution system, it is crucial to keep the extinction ratio of the coherent pulses stable. This means that the direct current bias point of the electro-optic modulator (EOM) used for generating coherent pulses must be locked. In this paper, an autobias control system based on a lock-in-amplifier for the EOM is introduced. Its drift information extracting theory and control method are analyzed comprehensively. The long term drift of the extinction ratio of the coherent pulses is measured by a single photon detector, which indicates that the autobias control system is effective for stabilizing the bias point of the EOM.