With the ongoing advancements and extensive utilization of internet of things (IoT) technologies, Fog computing architecture has become a hot research topic in recent years. This architecture supports numerous Cloud functionalities while addressing shortcomings using fog nodes (FNs) located close to users. FNs focus on providing processing and storage resources to resource-constrained IoT devices that cannot enable IoT applications with intense computational demands. Also, the proximity of FNs to IoT nodes satisfies the demands for latency-sensitive IoT applications. However, due to the high demand for IoT task offloading along with the resource limitations associated with IoT, it is crucial to develop an effective task-offloading solution that takes into account a number of quality parameters. Motivated by this, a Multi-Objective Task Offloading method is proposed based on the modified sparrow search algorithm (MOTO-MSSA) for offloading the tasks to FNs. MOTO-MSSA is portrayed as a multi-objective optimization method for reducing cost and response time. Extensive simulations demonstrate the superiority of MOTO-MSSA over existing techniques in three different situations with varying number of FNs, service availability, and data arrival rates. The proposed MOTO-MSSA demonstrates a significantly faster convergence speed, being approximately 2, 3.2, 3.4, 3.5, and 3.7 times faster than sparrow search algorithm (SSA), ant colony optimization (ACO), particle swarm optimization (PSO), artificial bee colony optimization (ABC), and round robin (RR), respectively. In scenario 1, it reduces the average response time (ART) by 5%, 12%, 16%, 11%, and 30% compared to SSA, ACO, PSO, ABC, and RR, respectively. Additionally, MOTO-MSSA reduces costs by approximately 2%, 9%, and 11% compared to SSA, ACO, and PSO. The results reveal that MOTO-MSSA boosts convergence speed and exceeds existing techniques in terms of cost and response time with minimum overhead.