The Internet of Things (IoT) concept is expected to be a crucial component of human life in the near future. In IoT, devices provide functionalities as services. By integrating primitive services of interconnected IoT devices, complex IoT applications are composed. In a large-scale IoT environment, the selection of IoT services is essential. The services must be selected considering Quality-of-Service (QoS), energy consumption, and fairness among IoT services. This paper proposes a multi-objective optimization-based IoT service composition framework for fog-based IoT networks. The proposed solution takes advantage of the NSGA-II (Non-dominated Sorting Genetic Algorithm II). The cloud controller distributes application requests to fog servers as application requests arrive. Fog servers decompose application requests into IoT service requests and then slice IoT service requests into time windows. Each time window is optimized individually using the proposed model considering QoS, energy consumption, and fairness. Experimental evaluation results show that the proposed approach can optimize energy consumption and fairness without causing any QoS degradation.