Nowadays, superconductors serve in numerous applications, from high-field magnets to ultrasensitive detectors of radiation. Mesoscopic superconducting devices, referring to those with nanoscale dimensions, are in a special position as they are easily driven out of equilibrium under typical operating conditions. The out-of-equilibrium superconductors are characterized by non-equilibrium quasiparticles. These extra excitations can compromise the performance of mesoscopic devices by introducing, for example, leakage currents or decreased coherence time in quantum devices. By applying an external magnetic field, one can conveniently suppress or redistribute the population of excess quasiparticles. In this article, we present an experimental demonstration and a theoretical analysis of such effective control of quasiparticles, resulting in electron cooling both in the Meissner and vortex states of a mesoscopic superconductor. We introduce a theoretical model of quasiparticle dynamics, which is in quantitative agreement with the experimental data.