We use 2D particle-in-cell (PIC) plasma simulations to study electron acceleration by electron temperature anisotropy instabilities, assuming magnetic fields (B), electron densities (n e ) and temperatures (T e ) typical of the top of contracting magnetic loops in solar flares. We focus on the long-term effect of T e,⊥ > T e, instabilities by driving the anisotropy growth during the whole simulation time (T e,⊥ and T e, are the temperatures perpendicular and parallel to the field). This is achieved by imposing a shear velocity, which amplifies the field due to magnetic flux freezing, making T e,⊥ > T e, due to electron magnetic moment conservation. We use the initial conditions: T e ∼ 52 MK, and B and n e such that the ratio between the electron cyclotron and plasma frequencies ω ce /ω pe = 0.53. When the anisotropy becomes large enough, oblique, quasi-electrostatic (OQES) modes grow, efficiently scattering the electrons and limiting their anisotropy. After that, when B has grown by a factor ∼ 2 − 3 (corresponding to ω ce /ω pe ∼ 1.2 − 1.5), the unstable modes become dominated by parallel, electromagnetic z (PEMZ) modes. In contrast to the OQES dominated regime, the scattering by PEMZ modes is highly inelastic, producing significant electron acceleration. When the field has grown by a final factor ∼ 4, the electron energy spectrum shows a nonthermal tail that resembles a power-law of index ∼ 2.9, plus a high-energy bump reaching ∼ 300 keV. Our results suggest a critical role played by ω ce /ω pe and T e in determining the efficiency of electron acceleration by temperature anisotropy instabilities in solar flares.