The investigation conducted in this work aims to investigate the stability response of functionally graded restrained nanobeams with four different porosity distributions and embedded in the Winkler foundation. To take into concern the size effects, Eringen's nonlocal elasticity is employed as a higher-order continuum theory. The material properties of the functionally graded porous nano-sized beam with deformable boundaries are changed gradually in spatial coordinates through the power-law model which covers four kinds of porosity distributions. A system of linear equations consists of infinite power series for an embedded functionally graded porous nanobeam under axial point loads obtained from Fourier trigonometric series and Stokes’ transformation is solved by an eigenvalue problem which satisfies rigid or deformable supporting conditions including classical boundary conditions such as simply supported, clamped-clamped and clamped-pinned. Analytical results are obtained for various porosity distributions and boundary conditions to reveal the effects of nonlocality, Winkler foundation and power-law index on the lateral buckling behavior of a functionally graded nanoscale nanobeam.