Due to the time-varying, hysteresis and nonlinear characteristics of fertilizer concentration control in the water–fertilizer ratio control system, common control algorithms such as PID and fuzzy PID cannot obtain the expected control effect. In order to accurately control the cotton field water–fertilizer ratio regulation system drip irrigation process of the water–fertilizer ratio that will be controlled within a reasonable range, it is needed to design a bat-optimized variable-domain fuzzy PID water–fertilizer ratio control strategy, through the use of bat algorithm to find out the optimal expansion factor and the best domain of the current conditions, and then according to the changes in working conditions to automatically adjust the fuzzy control of the domain, through the control of the valve openings to change the fertilizer pump back to the amount of water. Realize the fast and precise control of fertilizer concentration in the water–fertilizer ratio control system. Comparative tests were conducted to verify the traditional PID, fuzzy PID, variable domain fuzzy PID and bat-optimized variable-domain fuzzy PID control algorithms. The results show that: if the water–fertilizer ratio is adjusted to 50:1 from the startup, the adjustment time required to reach the target water–fertilizer ratio under the bat-optimized variable-domain fuzzy PID control is 15.29 s, and the maximum overshooting amount is 16.28%, which is a smaller adjustment time and overshooting amount; if the water–fertilizer ratio is adjusted to 40:1 from 50:1, the advantages of bat-optimized variable-domain fuzzy PID are more obvious, with the best balance of response speed, overshooting amount and optimal control effect. In terms of response speed, overshooting amount and regulation time, the optimal balance is achieved, showing the optimal control effect. It is proved that the performance of the water–fertilizer ratio regulation system in cotton field under bat-optimized variable-domain fuzzy PID control designed in this paper can meet the actual production requirements, and these findings can help to develop precise irrigation technology for cotton cultivation under drip irrigation conditions.