Future large-scale galaxy surveys have the potential to become leading probes for cosmology provided the influence of baryons on the total mass distribution is understood well enough. As hydrodynamical simulations strongly depend on details in the feedback implementations, no unique and robust predictions for baryonic effects currently exist. In this paper we propose a baryonic correction model that modifies the density field of dark-matter-only $N$-body simulations to mimic the effects of baryons from any underlying adopted feedback recipe. The model assumes haloes to consist of 4 components: 1- hot gas in hydrostatical equilibrium, 2- ejected gas from feedback processes, 3-central galaxy stars, and 4- adiabatically relaxed dark matter, which all modify the initial dark-matter-only density profiles. This altered mass profiles allow to define a displacement field for particles in $N$-body simulations and to modify the total density field accordingly. The main advantage of the baryonic correction model is to connect the total matter density field to the observable distribution of gas and stars in haloes, making it possible to parametrise baryonic effects on the matter power spectrum. We show that the most crucial quantities are the mass fraction of ejected gas and its corresponding ejection radius. The former controls how strongly baryons suppress the power spectrum, while the latter provides a measure of the scale where baryonic effects become important. A comparison with X-ray and Sunyaev-Zel'dovich cluster observations suggests that baryons suppress wave modes above $k\sim0.5$ h/Mpc with a maximum suppression of 10-25 percent around $k\sim 2$ h/Mpc. More detailed observations of the gas in the outskirts of groups and clusters are required to decrease the large uncertainties of these numbers.