Wireless sensor networks (WSNs) are targets of intrusion, which seeks to make these networks less capable of performing their duties or even completely eradicate them. The Intrusion Detection System (IDS) is highly important for WSN, since it aids in the identification and detection of harmful attacks that impair the network's regular functionality. In order to strengthen the security of WSN, several machine learning and deep learning approaches are employed in the traditional works. However, its main drawbacks are computational burden, system complexity, poor network performance outcomes, and high false alarms. Therefore, the goal of this study is to develop an intelligent IDS framework for significantly enhancing WSN security through the use of deep learning model. Here, the min-max normalization and data discretization operations are carried out to produce the preprocessed dataset. Then, an Intelligent Prairie Dog Optimization (IPDO) algorithm is used to reduce the dimensionality of features by identifying the best optimal solution with a higher convergence rate. Moreover, a Deep Auto-Neural Network (DANN) based classification method is used to properly forecast the class of data with less false alarms and higher detection rate. For evaluation, a thorough analysis is conducted to evaluate the performance and detection results of the proposed IPDO-DANN model.