Due to its outstanding performance in addressing optimization problems, artificial electric field (AEF) algorithm has garnered increasing notice in recent years. Nevertheless, numerous studies indicate that AEF is susceptible to premature convergence when the region influenced by the global optimum constitutes a small fraction of the entire solution space. By conducting micro‐level research on the particles during the evolution process of AEF, it is revealed that the primary factors influencing optimization performance are the Coulomb's electrostatic force mechanism and the fixed attenuation factor. Inspired by this observation, we propose an improved version named artificial electric field algorithm with repulsion mechanism (RMAEF). Specifically, in RMAEF, a repulsion mechanism is incorporated to make particles escape from local optima. Furthermore, an adaptive attenuation factor is employed to update dynamically Coulomb's constant. RMAEF is compared with AEF and its state‐of‐art variants under 44 test functions from CEC 2005 and CEC 2014 test suites. From the experiment results, it is obvious that among 14 benchmark functions from CEC 2005 on 30D and 50D optimization, the RMAEF algorithm exhibits superior performance on 8 and 9 functions compared with advanced variants of AEF. For CEC 2014 on 30D and 50D optimization, the RMAEF algorithm produces the best results on 11 and 12 functions, respectively. In addition, three real‐world problems are also used to verify the versatility and robustness. The results demonstrate that RMAEF outperforms its competitors in terms of overall performance.