One of the most significant strategy measures of wireless sensor networks (WSNs) is energy efficiency. Grouping affords an effective way for encompassing the lifetime of the network. We offer a double cluster-heading clustering algorithm using particle swarm optimization (PSO-DH). The algorithm computes two cluster skulls. The determination of the dominant cluster and the immorality cluster-head needs consider the state information, including position and energy reservation about nodes and their neighbors. Because every node contains a list of information about his neighbors and location using connected dominating set. The dominant cluster head (DCH) receives and masses data to analyst directly. The algorithm poises the energy consumption, so it can encompass the network life time effectively.