This work addresses the energy-based source localization problem in wireless sensors networks. Instead of circumventing the maximum likelihood (ML) problem by applying convex relaxations and approximations, we approach it directly by the use of metaheuristics. To the best of our knowledge, this is the first time that metaheuristics are applied to this type of problem. More specifically, an elephant herding optimization (EHO) algorithm is applied. Through extensive simulations, the key parameters of the EHO algorithm are optimized such that they match the energy decay model between two sensor nodes. A detailed analysis of the computational complexity is presented, as well as a performance comparison between the proposed algorithm and existing non-metaheuristic ones. Simulation results show that the new approach significantly outperforms existing solutions in noisy environments, encouraging further improvement and testing of metaheuristic methods.