Metaheuristic algorithms are effective for optimization with diverse applications in engineering. The optimum tuning of tuned mass dampers is very important for seismic structures excited by random vibrations, and optimization techniques have been used to obtain the best performance for optimally tuned mass dampers. In this study, a novel optimization approach employing the bat algorithm with several modifications for the tuned mass damper optimization problem is presented. In the proposed method, the design variables such as the mass, period and damping ratio of tuned mass damper are optimized and different earthquake records are considered during the optimization process. The method is then applied to a ten-story civil structure and the results are then compared with the analytical methods and other methods such as genetic algorithms, particle swarm optimization, and harmony search. The comparison shows that the proposed method is more effective than other compared methods. Additionally, the robustness of the optimum results was evaluated. The proposed approach for optimizating tuned mass dampers via the bat algorithm is a feasible and efficient approach.