Metformin is used to treat high blood sugar levels that are caused by a type of diabetes mellitus or sugar diabetes called type 2 diabetes. With this type of diabetes, insulin produced by the pancreas is not able to get sugar into the cells of the body where it can work properly.