The multiquadric radial basis function method has been widely used to solve partial differential equations-based problems regarding its flexibility and meshfree characteristics. The accuracy and stability of this method are derived and based on the use of a free-shape parameter that sensibly controls the comportment of the technique. Significant improvements have already been reported and show that variable shape parameters conduct the method to handle problems with striking results compared to global-based techniques. Nevertheless, choosing a suitable set of shape parameters is still an open topic because of the complexity of the method when the number of collocation points increases. The current work proposes a variant particle swarm optimization based on local displacement with attractors to determine the multi-quadratic function's ``best'' optimal variable shape parameter in solving boundary value problems. Based on an initially random set of variable shape parameters, the proposed algorithm first performs and evaluates the errors between the expected exact solution and the approximate solution thoroughly. In the first stage, the particle swarm algorithm search for an optimal set of shape parameters that minimize the error and the conditioning number of the radial basis system matrix. In the second stage, the obtained optimal set of shape parameters is applied to solve the considered problem. In this way, when the number of collocation points increases, the first stage based on particle swarm optimization stabilizes the strategy. It proposes an ``acceptable'' set of shape parameters for the given problem. The proposed method is applied to a set of well-known boundary value problems in one and two-dimensional spaces and compared to other techniques published in the literature. The results show that the proposed method achieves more accurate solutions than recently proposed in the literature.