In LaAlO3/SrTiO3 heterostructures, a still poorly understood phenomenon is that of electron trapping in back-gating experiments. Here, by combining magnetotransport measurements and self-consistent Schrödinger-Poisson calculations, we obtain an empirical relation between the amount of trapped electrons and the gate voltage. The amount of trapped electrons decays exponentially away from the interface. However, contrary to earlier observations, we find that the Fermi level remains well within the quantum well. The enhanced trapping of electrons induced by the gate voltage can therefore not be explained by a thermal escape mechanism. Further gate sweeping experiments strengthen that conclusion. We propose a new mechanism which involves the electromigration and clustering of oxygen vacancies in SrTiO3 and argue that such electron trapping is a universal phenomenon in SrTiO3-based two-dimensional electron systems.