Cloud computing is a prominent and evolving distributed computing paradigm that provides users with on-demand services through a network of diverse autonomous systems with flexible computational structures. Within this context, the significance of task scheduling becomes evident, serving as a vital component in elevating cloud computing's overall performance. Streamlining cost-effective execution and optimizing resource utilization is a key objective, given the NP-hard nature of the task scheduling problem. This intricacy has prompted researchers to investigate metaheuristic algorithms inspired by nature. Although numerous metaheuristic techniques have been explored to address task allocation challenges, ample opportunities remain for the development of optimal strategies. In this paper, a state-of-the-art task assignment model is presented, centered around OptiAssign-Particle Swarm Optimization (PSO), with a strong emphasis on the crucial role played by efficient dependency handling and multi-level task scheduling. The primary aim of this model is to optimize the utilization of virtual machine capacities while simultaneously minimizing execution time, makespan, wait time, and overall execution costs within various distributed computing systems. The novel algorithm showcases outstanding performance compared to traditional approaches in task scheduling, highlighting the importance of skillful dependency management and the implementation of multi-level task scheduling strategies. The conclusive results of the study further affirm the effectiveness of the model in addressing the inherent