Wireless sensor networks (WSNs) have become a very popular subject in both industrial and academic fields of study due to the fact that they can operate on their own, do not require extra maintenance, and can be utilized in a wide variety of applications. In addition, the sensor nodes having limited hardware resources and power units cause certain security problems awaiting to be resolved. The Denial-of-Service (DoS) attacks, which cause disrupts in the communication of sensor nodes or abnormal situations, thus resulting in the decrease of the lifespan of the network, constitute a serious threat against the WSN security. Especially in military applications in which security is the most important design criterion, the WSN used in chemical and biological intrusion detection applications must be resistant against all forms of attacks. In this study, an adaptive detection-defense unit has been developed against the DoS attacks (packet collision, exhaustion, and unfairness) which occur in the data link layer. The developed unit has also been implemented on the TelosB nodes. Due to the new unit that was designed the lifespan of the nodes has been extended without the need for additional hardware by making them more secure against DoS attacks in the data link layer of the WSN.