We have constructed an extended halo model (EHM) which relates the total stellar mass and star-formation rate (SFR) to halo mass (M_h). An empirical relation between the distribution functions of total stellar mass of galaxies and host halo mass, tuned to match the spatial density of galaxies over 0<z<2 and the clustering properties at z~0, is extended to include two different scenarios describing the variation of SFR on M_h. We also present new measurements of the redshift evolution of the average SFR for star-forming galaxies of different stellar mass up to z=2, using data from the Herschel Multi-tiered Extragalactic Survey (HerMES) for infrared-bright galaxies. Combining the EHM with the halo accretion histories from numerical simulations, we trace the stellar mass growth and star-formation history in halos spanning a range of masses. We find that: (1) The intensity of the star-forming activity in halos in the probed mass range has steadily decreased from z~2 to 0; (2) At a given epoch, halos in the mass range between a few times 10^{11} M_Sun and a few times 10^{12} M_Sun are the most efficient at hosting star formation; (3) The peak of SFR density shifts to lower mass halos over time; (4) Galaxies that are forming stars most actively at z~2 evolve into quiescent galaxies in todays group environments, strongly supporting previous claims that the most powerful starbursts at z~2 are progenitors of todays elliptical galaxies.