Wireless sensor networks (WSN) are widely used in various applications, such as environmental monitoring, healthcare, event detection, agriculture, disaster management, and so on. Due to their small size, sensors are limited power sources and are often deployed in special environments where frequent battery replacement is not feasible. Therefore, it is important to reduce the energy consumption of sensors and extend the network lifetime. An effective way to achieve this is clustering. This paper proposes a dual cluster-head energy-efficient algorithm (DCK-LEACH), which is based on K-means and Canopy optimization. Considering that the K-means algorithm is sensitive to the location of the initial clustering centers, this paper uses both the dynamic Canopy algorithm and K-means algorithm for clustering. For cluster-head election, this algorithm uses a hierarchy to minimize the cluster-head burden and balance the network load. The primary cluster-head is selected by two objectives: the node's residual energy and the distance from the node to the clustering center. The vice cluster-head is selected by the residual energy of the node, and the distance from the nodes to the base station. Simulator results show that DCK-LEACH significantly prolongs the energy-critical node lifetime and the network lifetime compared with existing protocols.