In today’s world, the main challenge is to save use energy optimally. The IoT devices generate a large amount of data for wide applications. Considering the application perspective in the IoT market, in one instance of the IoT technology, that is a wireless sensor network, factors like energy, storage capacity, computation power, and limitations of communication bandwidth resources are the reason for using data fusion. Data fusion and aggregation in wireless sensor networks (WSNs) such that minimum energy is consumed are an essential issue. In most clustering models, data aggregation is carried out by the cluster-head (CH). In the proposed algorithm, data aggregation in the cluster-head is carried out using the lossless cascode Huffman compression algorithm. Due to the correlation among data of nodes, the data sensed by each node is compared with the data of the cluster-head node; after removing redundancy, the coded data is transmitted to the main node. The CH node is selected by an algorithm based on fuzzy logic according to the residual energy of the node and the distance of the node from the sink node. Various fuzzy type-I systems of Mamdani and Takagi-Sugeno and type-II systems are used. In this paper, the CH selection algorithms are evaluated using three scenarios in terms of the number of live nodes, received packets and CHs, proper distribution rate, and other parameters of the LEACH protocol, network lifetime, and network energy. In the following, to demonstrate the performance of this new algorithm, simulations are performed in MATLAB based on the proposed method. The results show that the proposed compression algorithm in environments with high data correlation improves the compression rate by 8% compared to the conventional Huffman compression, while in environments with low data correlation, these two algorithms perform almost the same. This compression helps reduce the energy consumption of the network.