Microcantilever based sensors are promising devices because they are fast, low cost, portable and allow measuring extremely small quantities of substances in gas or liquid phase that are not detectable by other methods. In this work we investigate the swelling and deswelling behavior of poly(hydroxyl ethyl methacrylate), PHEMA, films with three different average molecular masses deposited onto bare silicon microcantilevers, a hydrophilic substrate, and onto polystyrene (PS) coated microcantilevers, which is a hydrophobic substrate, under humidity cycles by monitoring the deflections resulting from differential surface stress. The results found in the present study demonstrate that the micromechanical response observed are related not only to the polymer molecular weight, but also to the polymer-interface phenomena and environment–polymer interface that can play a crucial role on the signal transduction. Ellipsometric measurements evidenced that the swelling of PHEMA films with intermediate molecular weight at 80% RH follows Fickian diffusion mechanism. Nevertheless, due to the weak optical contrast or film homogeneity shorter or longer chains than PHEMA-300 could not be investigated by ellipsometry. PHEMA films deposited onto PS surfaces presented dewetting, which limited the ellipsometric measurements. In comparison to ellipsometry, monitoring swelling behavior of PHEMA by nanomechanical responses is more advantageous because it is faster and less restricted.