Disclosed is a method for the preparation of Cobicistat of formula I, or a salt thereof, comprising coupling ((thiazol-5-yl)methyl) (2R,5R)-5-amino-1,6-diphenylhexan-2-ylcarbamate or a salt thereof with potassium 4-(morpholin-4-yl)-2-(3-((isopropylthiazol-4-yl)methyl)-3-methylureido)butanoate (wherein M+ is K+). Preferably the coupling is carried out in dichloromethane at a temperature of from about -30°C to about 20°C in the presence of a coupling reagent such as EDC.HCl and HOBt or n-propanephosphonic acid cyclic anhydride.