The Internet of Things (IoT) points to billions of connected devices that share data through the Internet. However, the increasing amount of data generated by IoT devices makes remotely placed cloud data centers inefficient for delay-sensitive applications. In this regard, fog computing, which brings computation near the data source, plays a significant role in overcoming the above issue. However, resource constraints in fog demand an effective task-scheduling technique for the enormous amount of data. Many researchers have proposed a variety of heuristic and meta-heuristic approaches for effective scheduling; however, there is still scope for improvement. In this paper, we propose EMAPSO (energy makespan-aware PSO). The makespan and energy minimization simultaneously are presented as a bi-objective optimization problem. The approach also considered the load balancing factor while assigning a task to a VM in a fog/cloud environment. The proposed algorithm EMAPSO is compared to standard PSO, Modified PSO (MPSO), Bird swam optimization (BSO), and the Bee Life Algorithm (BLA). The experimental results show the proposed method outperforms the compared algorithms in terms of resource utilization, makespan, and energy consumption.