Self-injection locking is a dynamic phenomenon representing stabilization of the emission frequency of an oscillator with a passive cavity enabling frequency filtered coherent feedback to the oscillator cavity. For instance, self-injection locking of a semiconductor laser to a high-quality-factor (high-Q) whispering gallery mode (WGM) microresonator can result in multiple orders of magnitude reduction of the laser linewidth. The phenomenon was broadly studied in experiments, but its detailed theoretical model allowing improving the stabilization performance does not exist. In this paper we develop such a theory. We introduce five parameters identifying efficiency of the self-injection locking in an experiment, comprising back-scattering efficiency, phase delay between the laser and the high-Q cavities, frequency detuning between the laser and the high-Q cavities, the pump coupling efficiency, the optical path length between the laser and the microresonator. Our calculations show that the laser linewidth can be improved by two orders of magnitude compared with the case of not optimal self-injection locking. We present recommendations on the experimental realization of the optimal self-injection locking regime. The theoretical model provides deeper understanding of the self-injection locking and benefits multiple practical applications of self-injection locked oscillators.