  We present a systematic study of the environmental impact on star formation
activities of galaxies using a mass-complete sample of $\sim$170k galaxies at
$z<4$ from the latest COSMOS2020 catalog. At $z<1$, we find that the mean
star-formation rate (SFR) of all galaxies decreases with increasing density of
the environment. However when we consider only star-forming galaxies, the mean
SFR becomes independent of the environment at $z<1$. At $z>2$ we observe a
clear positive correlation between the SFR and density of the environment for
all the galaxies. On the other hand, stellar mass of the galaxies increases
significantly with the environments at all redshifts except for star-forming
galaxies at $z<1$. The fraction of quiescent galaxies increases with increasing
density of environment at $z<2$, and the ``morphology-density'' relation is
confirmed to be present up to $z\sim1$. We also find that environmental
quenching is negligible at $z>1$, whereas mass quenching is the dominant
quenching mechanism for massive galaxies at all redshifts. Based on these
results, we argue that stellar mass regulated physical processes might be the
major driving force for star formation activities of galaxies. At low redshift
($z<1$) massive galaxies are quenched primarily due to their high mass,
resulting in a normal ``SFR-density'' relation. At high redshift ($z>2$) most
of the galaxies are star-forming ones tightly following the star-forming main
sequence, and the difference in their stellar mass at different environments
naturally leads to a reversal of ``SFR-density'' relation.
