The goal of this study is to fill this apparent gap in the area about investigating free vibration of Functionally Graded Piezoelectric Materials (FGPMs) nanobeams with porosity resting on two-parameter elastic foundations, under voltage load considering Timoshenko beam model and nonlocal theory. The elastic foundation is considered as a Pasternak model with adding a shear layer to the Winkler model. The electromechanical and mechanical properties of the nanobeam (such as elastic, piezoelectric, dielectric coefficients and mass density) are FG in the thickness direction of the beam. Based on Hamilton principle, governing equations of the problem are derived. The Differential Quadrature Method (DQM) for solution of these equations are employed to determine the natural frequencies of the FGPM nanobeams at different Boundary Conditions (B.C.s). The influences of supporting conditions, the porosity coefficient and patterns including even and uneven, nonlocal parameter, Winkler foundation modulus, shear elastic foundation modulus, external voltage and power-law index on the electromechanical vibration characteristics of the FGPM nanobeams are discussed in details. It is found that the FG index and nonlocal parameter will reduce the natural frequencies of the FG nanobeam, while the Winkler and Pasternak moduli of the foundation show an opposite tendency.