Provided are a polymer having low cytotoxicity and capable of imparting surface hydrophilicity and biocompatibility to medical device surfaces by simple processing, a method for producing the polymer, and a surface treatment agent for medical devices. The polymer of the present invention has a particular ratio of structural units represented by the formulae (1a) and (1b), and a particular weight average molecular weight, and is useful as a surface treatment agent for various medical devices.