We explore the evolution of the morphology-density relation using the COSMOS Advanced Camera for Surveys ( ACS) and previous cluster studies. The Gini parameter measured in a Petrosian aperture is found to be an effective way of selecting early-type galaxies free from systematic effects with redshift. We find that galaxies are transformed from late- ( spiral and irregular) to early-type ( E+ S0) galaxies more rapidly in dense than in sparse regions. At a given density, the early-type fraction grows constantly with cosmic time, but the growth rate increases with density as a power law of index 0.29 +/- 0.02. However, at densities below 100 galaxies Mpc(-2), no evolution is found at z > 0.4. In contrast, the star formation-density relation shows strong evolution at all densities and redshifts, suggesting that different physical mechanisms are responsible for the morphological and star formation transformation. We show that photometric redshifts can measure local galaxy environment, but that the present results are limited by photometric redshift error to densities above Sigma=3 galaxies Mpc(-2).