This paper proposes a new approach for function optimization using a new variant of multi-scale quantum harmonic optimization algorithm (MQHOA). The new approach introduces a centroid motion to improve the convergence efficiency, which is called MQHOA with centroid motion (CM-MQHOA). Instead of replacing the worst particle by the current best individual in the quantum harmonic oscillator process in MQHOA, the weakest player is replaced by a current centroid position in the proposed algorithm. Simple mechanisms are added to maintain the diversity of the population and help achieve the global optima in difficult unimodal and multimodal search spaces. The benefits of the proposed algorithm are improved performance in terms of effectiveness, reliability, accuracy, and efficiency. The approach appears to be able to efficiently deal with several unimodal and multimodal benchmark functions. A variety of standard benchmark functions are used to illustrate the proposed approach. The experimental results are compared with several state-of-the-art optimization algorithms. The comparative results indicate the competitiveness of the proposed algorithm and suggest a viable and attractive addition to the portfolio of computational intelligence techniques.