By focusing 40-TW, 30-fs laser pulses to the peak intensity of 10
19 W/cm
2 onto a supersonic He gas jet, we generate quasi-monoenergetic electron beams for plasma density in the specific range 1.5×10
19 cm
-3≤n
e≤3.5×10
19 cm
-3. We show that the energy, charge, divergence and pointing stability of the beam can be controlled by changing n
e, and that higher electron energies and more stable beams are produced for lower densities. The observed variations are explained
physically by the interplay among pump depletion and dephasing between accelerated electrons and plasma wave. Two-dimensional
particle-in-cell simulations support the explanation by showing the evolution of the laser pulse in plasma and the specifics
of electron injection and acceleration. An optimized quasi-monoenergetic beam of over 300 MeV and 10 mrad angular divergence
is demonstrated at a plasma density of n
e≃1.5×10
19 cm
-3.
PACS 52.35.-g; 52.38.Hb; 52.38.Kd; 52.65.-y