The Internet of Things (IoT) generates massive data from smart devices that demand responses from cloud servers. However, sending tasks to the cloud reduces the power consumed by the users’ devices, but increases the transmission delay of the tasks. In contrast, sending tasks to the fog server reduces the transmission delay due to the shorter distance between the user and the server. However, this occurs at the user end’s expense of higher energy consumption. Thus, this study proposes a mathematical framework for workload allocation to model the power consumption and delay functions for both fog and clouds. After that, a Modified Least Laxity First (MLLF) algorithm was proposed to reduce the maximum delay threshold. Furthermore, a new multi-objective approach, namely the Non-dominated Particle Swarm Optimization (NPSO), is proposed to reduce energy consumption and delay compared to the state-of-the-art algorithms. The simulation results show that NPSO outperforms the state-of-the-art algorithm in reducing energy consumption, while NGSA-II proves its effectiveness in reducing transmission delay compared to the other algorithms in the experimental simulation. In addition, the MLLF algorithm reduces the maximum delay threshold by approximately 11% compared with other related algorithms. Moreover, the results prove that metaheuristics are more appropriate for distributed computing.