Objective Debris flow from the Hanjia gully develops on the left bank of the source area of the Fujiang River, Fenghe Village, Xiaohe Town, Songpan County, China. In recent years, debris flows have occurred frequently, and the largest debris flow occurred in August 2022, which seriously threatened the lives and properties of villagers in the Hanjia gully. Existing prevention and control engineering methods have decreased in effectiveness or even become ineffective. Currently, researchers have set a variety of extreme rainfall conditions and used FLO-2D to analyze the hazards of debris flow, based on which the governance effect of debris flow prevention and control engineering can be evaluated. However, there are few reports on how to improve the prevention and control engineering and evaluate the effect of the improved prevention and control engineering when the existing prevention and control engineering is ineffective. Methods To reduce damage to the Hanjia gully, the characteristics as well as prevention and control status of the debris flow in/from this gully were determined using remote sensing interpretation, field investigation, and FLO-2D numerical simulation; subsequently, improved prevention and control engineering was proposed. The hazard of debris flow before and after the improvements in prevention and control engineering under different rainfall frequencies were studied to analyze the effectiveness of the improved prevention and control engineering. Results The results show that the Hanjia gully is located in the "8.8" Jiuzhaigou earthquake disturbance area, the static reserves of post-earthquake landslides and collapses are about 49.79 × 104 m3, and the debris flow sources are abundant, which leads to frequent debris flow during heavy rainfall. The high-hazard area is concentrated in the No. 1 retaining dam, and Fenghe Village and Pingsong Highway are in the low-hazard area under a rainfall event occurring every 10 years, and the existing prevention and control engineering can effectively prevent the debris flow disaster. Under a rainfall event occurring once in 50 years, Fenghe Village is in the high-hazard area of debris flow. The debris flow rushes out of the drainage channel and destroys the Pingsong Highway. The maximum mud depth in the accumulation area increases from 1.41 m to 3.14 m, the maximum velocity increases from 2.4 m/s to 3.65 m/s, and the accumulation area increases from 0.28 × 104 m2 to 5.41 × 104 m2. However, the existing prevention and control engineering methods cannot meet these requirements. After adopting improved prevention and control engineering, such as multistage retaining dams and cutting and straightening of drainage channels, the flow velocity of the debris flow in front of the two additional retaining dams becomes lower than that before the improvement, and the depth of mud in front of the additional retaining dams becomes higher than that before the improvement. The maximum velocity of the debris flow within 100 m of Dam No. 3 decreases by 29%, and the maximum mud depth increases by 413%. The maximum flow velocity in the first 100 m of Dam No. 2 decreases by 21%, the maximum mud depth increases by 175%, the maximum mud depth in the accumulation area is 3.9 m, and the maximum flow velocity is 3.4 m/s. The accumulation volume of debris flows is reduced by 50.2%, and the accumulation area is reduced by 86%. Conclusion Improved prevention and control engineering can effectively reduce the solid mass of debris flows and guide debris flow to discharge along drainage channels. The high-hazard area of the debris flow is concentrated in the drainage channel, and the control effect of the debris flow is remarkable. Significance The research results provide a scientific method for evaluating the effectiveness of debris-flow control engineering improvements and offer technical support for local debris-flow early warning systems.