Injection locking can stabilize a source of radiation, leading to an efficient suppression of noise-induced spectral broadening and therefore, to a narrow spectrum. The technique is well established in laser physics, where a phenomenological description due to Adler is usually sufficient. Recently, locking experiments were performed in Josephson photonics devices, where microwave radiation is created by inelastic Cooper pair tunneling across a dc-biased Josephson junction connected in-series with a microwave resonator. An in-depth theory of locking for such devices, accounting for the Josephson non-linearity and the specific engineered environments, is lacking. Here, we study injection locking in a typical Josephson photonics device where the environment consists of a single mode cavity, operated in the classical regime. We show that an in-series resistance, however small, is an important ingredient in describing self-sustained Josephson oscillations and enables the locking region. We derive a dynamical equation describing locking, similar to an Adler equation, from the specific circuit equations. The effect of noise on the locked Josephson phase is described in terms of phase slips in a modified washboard potential. For weak noise, the spectral broadening is reduced exponentially with the injection signal. When this signal is provided from a second Josephson device, the two devices synchronize. In the linearized limit, we recover the Kuramoto model of synchronized oscillators. The picture of classical phase slips established here suggests a natural extension towards a theory of locking in the quantum regime.