The relation between the galaxy stellar mass M_star and the dark matter halo mass M_h gives important information on the efficiency in forming stars and assembling stellar mass in galaxies. We present the stellar mass to halo mass ratio (SMHR) measurements at redshifts 2<z<5, obtained from the VIMOS Ultra Deep Survey. We use halo occupation distribution (HOD) modelling of clustering measurements on ~3000 galaxies with spectroscopic redshifts to derive the dark matter halo mass M_h, and SED fitting over a large set of multi-wavelength data to derive the stellar mass M_star and compute the SMHR=M_star/M_h. We find that the SMHR ranges from 1% to 2.5% for galaxies with M_star=1.3x10^9 M_sun to M_star=7.4x10^9 M_sun in DM halos with M_h=1.3x10^{11} M_sun} to M_h=3x10^{11} M_sun. We derive the integrated star formation efficiency (ISFE) of these galaxies and find that the star formation efficiency is a moderate 6-9% for lower mass galaxies while it is relatively high at 16% for galaxies with the median stellar mass of the sample ~7x10^9 M_sun. The lower ISFE at lower masses may indicate that some efficient means of suppressing star formation is at work (like SNe feedback), while the high ISFE for the average galaxy at z~3 is indicating that these galaxies are efficiently building-up their stellar mass at a key epoch in the mass assembly process. We further infer that the average mass galaxy at z~3 will start experiencing star formation quenching within a few hundred millions years.