In the past few decades, there has been significant progress made in metasurfaces and integrated and miniaturized optical devices. As one of the most prominent applications of metasurfaces, the metalens is the subject of significant research. In this paper, for achieving better focusing performance of the initial metalens designed by the Pancharatnam–Berry (PB) phase, a concept of micro-dimensional oscillation is proposed to optimize the geometric parameters of nanopillars. A strategy of grouping iteration is proposed to reduce the loss rate and computational effort in a holistic way. Its essence is to divide an extremely large-scale optimization space into many overlapping groups. Meanwhile, an improved genetic-simulated annealing (IGSA) algorithm is presented for the optimal solution of each group. By introducing the adaptive crossover and mutation probabilities in traditional genetic algorithms, the IGSA algorithm has both strong global searching capability and excellent local searching capability. After optimization, the maximum field intensity of the central hot spot can be increased by about 8% compared to the initial metalens. Moreover, the field intensity of the side lobes around the hot spot is almost constant, and the central hot spot increases, which provides a potential for the realization of high imaging contrast.