To ensure safer drilling and to prevent kicks and blowouts, Managed Pressure Drilling (MPD) technology has been proposed. However, conventional MPD necessitates manual operation of the choke within the choke manifolds by engineers, a task heavily reliant on their experience. This paper proposes a PID controller tuned using the Dung Beetle Optimizer (DBO) and details several laboratory experiments on automatic choke control utilising DBO-PID alongside a modified hydraulic control box. The experimental results demonstrate that DBO-PID can quickly and stably control the surface back pressure (SBP) to the desired level. Following extensive laboratory experiments validation, a field experiment implementing DBO-PID with a hydraulic control box was conducted on an offshore platform. The field experiment results indicate that DBO-PID is 29 % faster than manual control by an engineer in stabilising the SBP, with an overshoot of less than 4 % when nearing the target SBP. Additionally, during the control processes for both constant and variably targeted SBP, pressure fluctuation was 72 % and 63 % less, respectively, compared to manual operation. Both laboratory and field experiments have conclusively demonstrated that the automatic choke control system, comprising DBO-PID and a hydraulic control box, can efficiently manage SBP, thereby preventing kicks and blowouts. Furthermore, this system could replace manual operations in MPD, enhancing the safety of oil and gas resource development, protecting engineers' lives, and safeguarding the natural environment.