Sensor networks are tiny independent devices which are characterized by limiting battery, processing power and storage memory, that makes saving consumption energy as real challenge power. Morever, there are many techniques used used to conserve energy in Wireless Sensor Networks (WSNs) the clustering technique is one of them. In terms of security, WSNs are more vulnerable to attacks than wired networks. However, radio frequencies used in WSNs are open, making the eavesdropping fairly easy. By considering energy consumption and in order to prevent from Denial of Service (DoS) attacks, present study introducing a preventing DoS attacks approach, which is based on using clustering techniques.