  We present a study of the environment of 27 z=3-4.5 bright quasars from the
MUSE Analysis of Gas around Galaxies (MAGG) survey. With medium-depth MUSE
observations (4 hours on target per field), we characterise the effects of
quasars on their surroundings by studying simultaneously the properties of
extended gas nebulae and Lyalpha emitters (LAEs) in the quasar host haloes. We
detect extended (up to ~ 100 kpc) Lyalpha emission around all MAGG quasars,
finding a very weak redshift evolution between z=3 and z=6. By stacking the
MUSE datacubes, we confidently detect extended emission of CIV and only
marginally detect extended HeII up to ~40 kpc, implying that the gas is metal
enriched. Moreover, our observations show a significant overdensity of LAEs
within 300 km/s from the quasar systemic redshifts estimated from the nebular
emission. The luminosity functions and equivalent width distributions of these
LAEs show similar shapes with respect to LAEs away from quasars suggesting that
the Lyalpha emission of the majority of these sources is not significantly
boosted by the quasar radiation or other processes related to the quasar
environment. Within this framework, the observed LAE overdensities and our
kinematic measurements imply that bright quasars at z=3-4.5 are hosted by
haloes in the mass range ~ 10^{12.0}-10^{12.5} Msun.
