At present, China is not only the country with the most highway tunnels, but also the country with the longest railway tunnels, but with the increase of tunnel use time, its structure is gradually aging, resulting in arch settlement, segment damage, misplacement, and leakage a series of problems; in order to solve these problems, regular monitoring and maintenance of the tunnel is needed, because manual monitoring and maintenance of the tunnel during the operation is very inconvenient. Based on the above background, the purpose of this paper is to study the tunnel health monitoring system based on wireless sensor networks. First, this article uses a modular approach to develop the system hardware platform, focusing on the design of the ZigBee wireless communication unit, power management unit, flash data storage unit, clock unit, etc.; then, in order to ensure the reliability of the sensor data, design correction error detection and detection algorithms are embedded in the underlying nodes to reduce errors in the storage and transmission of data. At the same time, for the interference of sensor data during acquisition, wavelet denoising is used to preprocess the data, and a random forest algorithm is used to establish the tunnel health monitoring and evaluation system analyzes and evaluates the tunnel status information. Finally, experimental verification is performed. The experimental results show that the wireless sensor data loss rate is 9% when a train passes, and the wireless sensor data loss rate is only 3% when no train passes. By optimizing the node arrangement and ad hoc network, the reliability of data transmission can be improved.