Cloud computing seems to be the result of advancements in distributed computing, parallel computing, and network computing. The management and allocation of cloud resources have emerged as a central research direction. An intelligent resource allocation system can significantly minimize the costs and wasting of resources. In this paper, we present a task scheduling technique based on the advanced Phasmatodea Population Evolution (APPE) algorithm in a heterogeneous cloud environment. The algorithm accelerates up the time taken for finding solutions by improving the convergent evolution of the nearest optimal solutions. It then adds a restart strategy to prevent the algorithm from entering local optimization and balance its exploration and development capabilities. Furthermore, the evaluation function is meant to find the best solutions by considering the makespan, resource cost, and load balancing degree. The results of the APPE algorithm being tested on 30 benchmark functions show that it outperforms similar algorithms. Simultaneously, the algorithm solves the task scheduling problem in the cloud computing environment. This method has a faster convergence time and greater resource usage when compared to other algorithms.