Using a sample of 25683 star-forming and 2821 passive galaxies at $zsim2$, selected in the COSMOS field following the BzK color criterion, we study the hosting halo mass and environment of galaxies as a function of their physical properties. Spitzer and Herschel provide accurate SFR estimates for starburst galaxies. We measure the auto- and cross-correlation functions of various galaxy sub-samples and infer the properties of their hosting halos using both an HOD model and the linear bias at large scale. We find that passive and star-forming galaxies obey a similarly rising relation between the halo and stellar mass. The mean host halo mass of star forming galaxies increases with the star formation rate between 30 and 200 M$_odot$.yr$^{-1}$, but flattens for higher values, except if we select only main-sequence galaxies. This reflects the expected transition from a regime of secular co-evolution of the halos and the galaxies to a regime of episodic starburst. We find similar large scale biases for main-sequence, passive, and starburst galaxies at equal stellar mass, suggesting that these populations live in halos of the same mass. We detect an excess of clustering on small scales for passive galaxies and showed, by measuring the large-scale bias of close pairs, that this excess is caused by a small fraction ($sim16%$) of passive galaxies being hosted by massive halos ($sim 3 times 10^{13}$ M$_odot$) as satellites. Finally, extrapolating the growth of halos hosting the z$sim$2 population, we show that M$_star sim 10^{10}$ M$_odot$ galaxies at z$sim$2 will evolve, on average, into massive (M$_star sim 10^{11}$ M$_odot$), field galaxies in the local Universe and M$_star sim 10^{11}$ M$_odot$ galaxies at z=2 into local, massive, group galaxies. The most massive main-sequence galaxies and close pairs of massive, passive galaxies end up in todays clusters.