Wireless sensor network (WSN) is a kind of big data collecting network with limited energy source. The energy consumption of the sensor nodes influences the performance and life span of the whole system. Thus, an increasing number of research of data collection via WSN is focused on looking for a cluster head (CH) selection method to realize uniform energy consumption. In this paper, we proposed an advanced algorithm based on the Low Energy Adaptive Clustering Hierarchy (LEACH) and its centralized version LEACH-C, named Weighted K-means Based LEACH-C (WLEACH-CK), for energy efficient clustering of sensor nodes in WSN for efficient routing. In the set-up state, base station (BS) calculates the optimum number of CHs. K-means algorithm is used for clustering. The node with lowest weighted communication distance is selected to be the CH, in which the weight is calculated by the ratio of the initial energy and the residual energy. In the steady state, information is transmitted from the non-CH nodes to their CH. After performing data fusion function, the CH transmits information to the BS. We conclude from the simulation results that the energy consumption of each node is well balanced compared to the LEACH and LEACH-CK algorithm. Therefore, the lifetime of the WSNs has been prolonged by the proposed WLEACH-CK.