Clustering plays a crucial role in data mining and machine learning, with the primary objective being the identification of cohesive and distinct data groups, enabling the extraction of valuable information. However, clustering algorithms often encounter the challenge of getting trapped in local optima, hindering their ability to achieve optimal results. To address this issue, researchers have turned to using meta-heuristic algorithms. This article proposes an enhanced approach for clustering by combining the particle swarm optimization algorithm and the mountain gazelle algorithm. The utilization of this combined algorithm has shown superior performance compared to relying solely on the particle swarm algorithm. By using the strengths of both algorithms, our method overcomes the limitations posed by local optima, leading to more accurate and robust clustering results. The proposed algorithm utilizes the minimum fitness measure to locate the optimal centroid, which is determined based on three constraints: intra-cluster distance, inter-cluster distance, and cluster density. The data is then clustered using the optimal centroid corresponding to the minimal value of the fitness. The performance of our proposed approach has been evaluated on real-world datasets such as Iris, Wine, and Vowel. Our method and PSO and MGO algorithms have been compared on these datasets. The results of the experiments indicate that our proposed method outperforms the PSO and MGO algorithms in terms of clustering quality and convergence speed.