In topical drug formulations, HPMC gel acts as a thickener, increasing the viscosity of creams and ointments. It helps improve the spread of active pharmaceutical ingredients (APIs) on the skin and prolongs their contact time.