We present a measurement of the quasar luminosity function in the range 0.68<z<4 down to extinction corrected magnitude g_dered=22.5, using a simple and well understood target selection technique based on the time-variability of quasars. The completeness of our sample was derived directly from a control sample of quasars, without requiring complex simulations of quasar light-curves or colors. A total of 1877 quasar spectra were obtained from dedicated programs on the Sloan telescope (as part of the SDSS-III/BOSS survey) and on the Multiple Mirror Telescope. They allowed us to derive the quasar luminosity function. It agrees well with previously published results in the redshift range 0.68<z<2.6. Our deeper data allow us to extend the measurement to z=4. We measured quasar densities to g_dered<22.5, obtaining 30 QSO per deg^2 at z<1, 99 QSO per deg^2 for 1<z<2.15, and 47 QSO per deg^2 at z>2.15. Using pure luminosity evolution models, we fitted our LF measurements, and predicted quasar number counts as a function of redshift and observed magnitude. These predictions are useful inputs for future cosmology surveys such as those relying on the observation of quasars to measure baryon acoustic oscillations.