The present invention relates to formulation of in situ gelling drug delivery system for diabetes wherein formulation comprises of Metformin HC1, Pluronic F 127, HPMC E 50 and Sorbitol. Furthermore, the invention also relates to a method for sustainable release of drug and evaluation of in situ gel.