Periodic photonic structures have attracted much interest due to their versatility for controlling light propagation. The dispersion of photon modes in photonic lattices exhibits an energy band structure analo-gous to the electronic one in crystals. An important consequence of the photonic band structure is the localization of light in a band gap, which can be engineered by breaking the translational symmetry introducing a defect in the lattice. Here, we demonstrate experimentally the localization of light in a two-dimensional periodic system of polaritons confined in a patterned microcavity. We generate a self-trapping of light by optically inducing a local breaking of the strong-coupling regime of excitons to photons. In the photon lasing regime we show the existence of confined modes that can be controlled by the shape of the generated defect. We demonstrate single on-site localization with lasing mode at the edge of the Brillouin zone similar to a gap soliton. Our results pave the way for useful tools to optically control localization and propagation of light towards the generation of microlasers.