In order to solve the abnormal behaviors in wireless sensor networks, such as attacks, intrusions, node failures, and data anomalies, a data anomaly detection method for sensor networks based on DNN algorithm and cluster analysis is proposed. The deep neural network is introduced into the wireless sensor network, and each wireless sensor data is described by the neuron to construct the neural network element model. The traditional neural network model is improved, and the neural network model of the wireless sensor is used to realize the fusion and extraction of the data collected by the wireless sensor network. The clustering technology is used to complete the abnormal data judgment of the nodes, and at the same time, the spatial correlation of the sensing data between neighboring nodes is used to filter the noise data, extract the abnormal event information, and assist the system decision-making. The results show that when the number of neighbor nodes increases, the number of nodes with similar physical locations in the optimal neighbor node set gradually increases, and the accuracy rate is also continuously improved. However, if too many nodes are selected, the algorithm will use the data of nodes with a longer physical distance to vote, which will lead to an increase in the error rate. Therefore, when determining the number of neighbor nodes, 25%-30% of the total number of nodes in the positioning scenario can be selected. Therefore, the algorithm can effectively detect and distinguish environmental noise and abnormal events in the network.