The invention provides a system and a method for tracking a moving target based on a wireless sensor network. The system comprises a sink node, a gateway, a server and a plurality of sensor node devices; and the tracking method comprises the following steps: evenly arranging the sensor node devices in a target monitoring area; starting the sensor node devices and server software, and making preparation for receiving data of the wireless sensor network; when a passive infrared sensor detects a target, starting ultrasonic ranging and operating Extended Kalman Filtering Algorithm to obtain a target position coordinate; adopting a principle of a minimum covariance matrix track to select a task node of the next time; and reading initial data from the sink node through the gateway, drawing a data curve and a target track, saving the data, and transmitting a server instruction to a node of a specified ID through the gateway by the server. The system and the method can accurately detect and report the position of the moving target in a monitoring area, adopt an effective sensor awakening mechanism and greatly save energy consumption of the nodes.