Abstract Objective To achieve better control effect of the controller on the liquid level of LNG carrier and achieve the goal of energy saving and carbon reduction. Method This paper took the loaded square tank of an S175 high-speed container ship as the research plant, combined with the closed-loop gain-shaping algorithm (CGSA) and nonlinear modification technology to further optimize the controller. We initially employed a third-order CGSA approach in formulating the foundation of our linear controller. Subsequently, we introduced a non-linear modification to this controller by harnessing the power of the hyperbolic tangent function, and the control effect is verified by the MATLAB simulation experiment. Results Based on the outcomes of our MATLAB simulations, by integrating the third-order CGSA technique and introducing non-linear modification through the hyperbolic tangent function, we observed a significant enhancement in the controller's performance. Specifically, it outperformed the traditional PID controller by a substantial margin, demonstrating a remarkable 19% boost in control efficacy. Additionally, it provides better energy savings than the non-linear controller. Conclusion The controller designed in this paper has a better control effect on liquid tank level control of LNG ships, the control process is more energy-saving, and the purpose of carbon reduction is realized.