Nodes in most wireless sensor networks (WSNs) are powered by batteries with limited energy. Prolonging network lifetime and saving energy are two critical issues for WSNs. Clustering is an effective technique to improve the energy efficiency and prolong network lifetime of wireless sensor networks. In this paper, an energy efficient dynamic clustering protocol (EEDCP) based on weight for wireless sensor networks is proposed, which is able to dramatically prolong network lifetime and save energy. In the EEDCP, we introduce the typical energy model to compute energy consumption, virtual grid technology to construct cluster and a long sleeping state to reduce energy consumption. In addition, we use the value of weight to measure the size of residual energy instead of voting, which can significant reduce the voting times and the number of transmitting information. Further, simulation experiments are conducted to compare the EEDCP with some well-known clustering algorithms and simulation results show that the proposed method overcomes the existing methods in the aspects of energy consumption and network lifetime in wireless sensor networks.