Theory of injection locking is developed for a two-mode electron maser with close frequencies, when the driving signal affects both modes. There exist two regimes of phase locking in which either first or second mode dominates. Hard transitions between the two regimes are observed with variation of the driving frequency. The results of numerical simulations are presented for the case of driving by a signal with linear frequency chirp, as well as by a signal with sinusoidal frequency modulation. The effect of bifurcation delay is observed with the increase of chirp rate.