Load balancing (LB) is a key characteristic that more or less prevents fog computing devices by regulating energy consumption, cost, speed, and latency. In this cloud environment, all current LB technologies are rarely effective. The fog computing system is now unable to predict the appearance of client inquiries about this confusing management. Because each system has its own set of functions, scheduling tasks across networks become an extremely challenging task. Many cloud experts recently switched to LB. This means resource administration which produces several methods for achieving such a goal including the performance measures, a proposed technique of improving fog computing capacity, power consumption, and computing cost. The above method is used in a fog computing state to improve energy consumption and response speed using a hybrid optimization method of Oppositional Sparrow Search with Gravitational Search Algorithm (OSS-GSA). The proposed technology is adaptable and fast and could be used to improve overall energy efficiency while reducing energy consumption. The hybrid proposal OSS-GSA optimization method used to improve LB performance measurements such as improving energy efficiency and overall cost occurrence has been reduced in fog environments.