The Internet of Things (IoT) generates a large volume of data whenever devices are interconnected and exchange data across a network. As a result, there is a range of services with varying needs, for example, capacity requirements, data quality, and latency demands. These services operate on fog computing devices, which are limited in power and bandwidth compared to the cloud. The main challenge is deciding where to implement services on the fog, the cloud, or the hybrid. This paper proposes an efficient allocation technique that pushes processing closer to the network's fog side. It investigates which devices and services may best allocate while preserving resource usage in the IoT architecture. It also examines the importance of allocating services to devices and optimizing resource use in fog computing. In IoT settings, there is a wide range of services and devices; thus, it is critical to effectively assign the services to the devices. We propose Priority-based Service allocation (PSA) and Sort-based Service Allocation (SSA) techniques, which are used to enable an optimum order to employ devices to perform the various services. The experimental results indicate that our proposed technique minimize the data communication over the network by 82% by allocating most of the services locally in fog. We have maximized the number of distributed services to fog devices by 90% while minimizing the wastage of fog resources.