A method for controlling the gate based on the habitat requirement for fish overwintering in rivers. According to the characteristics of biological habitat of the river and the habitat demand of fishes during overwintering, the method specifically comprises the steps of: firstly, determining candidate fishes for ecological flow calculation though fish resources investigating and historical data, and then screening out the target fish by adopting hierarchical analysis method; Secondly, establishing a quantitative response relationship curve between target fish physiological adaptions and water temperature, obtaining ecological water level which ensures the target fish overwintering safely according to the vertical temperature distribution, and establishing the relation between water depth and discharge using hydrodynamic model; finally, setting up a gate control system including a radar water level meter in the overwintering areas and an ecological water level management system in a gate control room.