Metaheuristic algorithms are used to solve NP-hard optimization problems. These algorithms have two main components, i.e. exploration and exploitation, and try to strike a balance between exploration and exploitation to achieve the best possible near-optimal solution. The bat algorithm is one of the metaheuristic algorithms with poor exploration and exploitation. In this paper, exploration and exploitation processes of Gray Wolf Optimizer (GWO) algorithm are applied to some of the solutions produced by the bat algorithm. Therefore, part of the population of the bat algorithm is changed by two processes (i.e. exploration and exploitation) of GWO; the new population enters the bat algorithm population when its result is better than that of the exploitation and exploration operators of the bat algorithm. Thereby, better new solutions are introduced into the bat algorithm at each step. In this paper, 20 mathematic benchmark functions are used to evaluate and compare the proposed method. The simulation results show that the proposed method outperforms the bat algorithm and other metaheuristic algorithms in most implementations and has a high performance.