The gravitational search algorithm (GSA) is a meta-heuristic optimization algorithm which is inspired by the gravity force. This algorithm uses Newton's gravity and motion laws to calculate the masses interactions and shows high performance in solving optimization problems. The premature convergence is the common drawback of heuristic search algorithms in high-dimensional problems, and GSA is not an exception. In this paper, a new version of GSA is proposed to improve the power of GSA in exploration and exploitation. The proposed algorithm has both attractive and repulsive forces. In this algorithm, the heavy particles attract some particles and repulse some others, in which the forces are inversely proportional to their distances. For better evaluation, the GSA with both attractive and repulsive forces (AR-GSA) is tested using CEC 2013 benchmark functions and the results are compared with some well-known meta-heuristic algorithms. The simulation results show that AR-GSA can improve the convergence rate, the exploration, and the exploitation capabilities of GSA.