  [Abridged] We use the final data of the VIMOS Public Extragalactic Redshift
Survey (VIPERS) to investigate the effect of environment on the evolution of
galaxies between $z=0.5$ and $z=0.9$. We characterise local environment in
terms of the density contrast smoothed over a cylindrical kernel, the scale of
which is defined by the distance to the $5^{th}$ nearest neighbour. We find
that more massive galaxies tend to reside in higher-density environments over
the full redshift range explored. Defining star-forming and passive galaxies
through their (NUV$-r$) vs ($r-K$) colours, we then quantify the fraction of
star-forming over passive galaxies, $f_{\rm ap}$, as a function of environment
at fixed stellar mass. $f_{\rm ap}$ is higher in low-density regions for
galaxies with masses ranging from $\log(\mathcal{M}/\mathcal{M}_\odot)=10.38$
(the lowest value explored) to at least
$\log(\mathcal{M}/\mathcal{M}_\odot)\sim11.3$, although with decreasing
significance going from lower to higher masses. This is the first time that
environmental effects on high-mass galaxies are clearly detected at redshifts
as high as $z\sim0.9$. We compared these results to VIPERS-like galaxy mock
catalogues based on the galaxy formation model of De Lucia & Blaizot. The model
correctly reproduces $f_{\rm ap}$ in low-density environments, but
underpredicts it at high densities. The discrepancy is particularly strong for
the lowest-mass bins. We find that this discrepancy is driven by an excess of
low-mass passive satellite galaxies in the model. Looking at the accretion
history of these model galaxies, i.e. the times when they become satellites, a
better (yet not perfect) agreement with observations can be obtained in high
density regions by assuming either that a not-negligible fraction of satellites
is destroyed, or that their quenching time-scale is longer than $\sim 2$ Gyr.
