This study is aimed to find out the relation between the vibration motion and control of an atomic force microscope (AFM) piezoelectric microcantilever for free and forced vibrations in the air environment. In fact, the MC is the most important part of AFM, performing the most vital operations. Hence, the dynamic analysis and control of the MC are mandatory to obtain optimal performance. Enhancing the optimization of this system increases the sampling rate as well as the accuracy and resolution of the obtained images. MCs with a piezoelectric layer possess a higher speed and accuracy compared to conventional MCs which are simpler and less expensive. Also, in the MC vibration modeling, the Timoshenko beam model based on the modified couple stress theory is used. Next, using the Hamilton’s principle, the MC motion equations are derived by considering the geometric discontinuities as a result of the piezoelectric layer and two electrode layers. These equations are solved by using the finite element method. The MC frequency and time responses at different distances from the sample surface are obtained and compared with experimental results. In addition, the sample surface topography in the non-contact mode when the MC passes through different roughnesses in the first and second vibration modes has been investigated. Moreover, the fuzzy-sliding mode control (FSMC), which is a robust control method, is employed due to uncertainties when modeling the system. The results are compared with those of the sliding mode control (SMC) and PID control methods. For the cases of far from the surface and close to it, the MC is actuated by the piezoelectric layer and piezo-stack base, respectively. The proposed FSMC control can properly reduce chattering in the SMC to improve the results.