The stabilizing and shifting of laser frequency are very important for the interaction between the laser and atoms. The modulation transfer spectroscopy for the 87Rb atom with D2 line transition F = 2 → F' = 3 is used for stabilizing and shifting the frequency of the external cavity grating feedback diode laser. The resonant phase modulator with electro—optical effect is used to generate frequency sideband to lock the laser frequency. In the locking scheme, circularly polarized pump- and probe-beams are used. By optimizing the temperature of the vapor, the pump- and probe-beam intensity, the laser linewidth of 280 kHz is obtained. Furthermore, the magnetic field generated by a solenoid is added into the system. Therefore the system can achieve the frequency locking at any point in a range of hundreds of megahertz frequency shifting with very low power loss.