Using the Bogomol’nyi–Prasad–Sommerfield Lagrangian method, we show that gravity theory coupled to matter in various dimensions may possess Bogomol’nyi-like equations, which are first-order differential equations, satisfying the Einstein equations and the Euler–Lagrange equations of classical fields (U(1) gauge and scalar fields). In particular we consider static and spherically symmetric solutions by taking proper ansatzes and then we find an effective Lagrangian density that can reproduce the Einstein equations and the Euler–Lagrange equations of the classical fields. We consider the BPS Lagrangian density to be linear function of first-order derivative of all the fields. From these two Lagrangian desities we are able to obtain the Bogomol’nyi-like equations whose some of solutions are well-known such as Schwarzschild, Reissner–Nordström, Tangherlini black holes, and the recent black holes with scalar hair in three dimensions (Phys. Rev. D 107, 124047). Using these Bogomol’nyi-like equations, we are also able to find new solutions for scalar hair black holes in three and four dimensional spacetime. Furthermore we show that the Bogomol’nyi–Prasad–Sommerfield Lagrangian method can provide a simple alternative proof of black holes uniqueness theorems in any dimension.