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. The significance of task scheduling becomes evident, serving as a vital component to 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. Although numerous meta-heuristic techniques have been explored to address task allocation challenges, ample opportunities remain for the development of optimal strategies. This paper presents a state-of-the-art task assignment model that revolves 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, simultaneously minimizing execution time, makespan, wait time, and overall execution costs within a variety of distributed computing systems. This novel algorithm showcases outstanding performance when compared to traditional approaches in task scheduling, highlighting the importance of skillful dependency management and the implementation of multi-level task scheduling strategies. The results of this study further affirm the effectiveness of the model in addressing the inherent complexities of scenarios involving intricate task dependencies and diverse scheduling priorities.