Due to the type of applications, wireless sensor nodes must always be energy efficient and small. Hence, the presence of constraints such as the limitation of energy resource is inevitable. So far, several studies have been carried out in order to present solutions for the reduction in energy consumption. In the meantime, clustering is given prime significance as an efficient method, which means partitioning network into distinct areas and is a way for managing nodes communication. Two well-known methods, LEACH and HEED in this field have had a great performance in energy saving and quality of services in WSNs. In this paper, a new method of clustering and selection of cluster heads has been proposed based on energy efficiency and due to residual energy of each node by applying weighting coefficients. The results of analyses and simulations and comparison of proposed method by LEACH and HEED algorithms show that the proposed method has significant impact on energy efficiency and performance improvement of the sensor network.