In this paper, the vibration motions of multilayered piezoelectric microcantilevers (MCs) are analyzed in which these MCs are able to perform both actuating and sensing of tip deflection simultaneously. With respect to the presence of piezoelectric layers, these MCs modeled in several structures such as two layers and two segments. The governing equations of motion for these MCs are obtained using Hamilton's principle. It should be noted that the microcantilever (MC) is modeled as a continuous beam based on Euler-Bernoulli beam theory. Then, the obtained differential equation is solved by finite element method and the time response is obtained using Newmark method. In simulation of the vibrating behavior of MCs in contact mode, the flexible beam model includes attractive, adhesive and repulsive forces, as well as the interaction of the capillary fluid layers. In order to study vibrating motion of MC, the effect of air moisture and the tip-sample equilibrium distance as environmental parameters on the amplitude and current output are investigated, and also, a sensitivity analyses are conducted on the amplitude and current output of sensor in terms of the geometrical parameters of the MC layers and the results are analyzed.