Many problems are associated with dynamic changes in the power system, mainly because the number of switching loads has increased. These loads induce ineffective system behaviour, reduce the system voltage profile, and lead to improper voltage regulation. The proposed Automatic Voltage Regulator (AVR) system is intended to eliminate the above problem and preserve the system voltage at the generator terminal within the allowable range. In this work, Proportional-Integral-Derivative (PID) controllers are applied to enhance the dynamic behaviour of the AVR system. The Zebra Optimization Algorithm (ZOA) and Osprey Optimization Algorithm (OOA) algorithms are implemented to optimize the system's transient response by modifying the gain of PID controller parameters, which include proportional, integral, and derivative parameters, to preserve a stable voltage profile. To achieve an optimal solution, the mathematical model of the proposed system is realized in the Internet of Things (IoT). The connected loads in the system can operate at the nominal voltage level through PID controller tuning using ZOA and OOA. The proposed system's performance is evaluated and verified with MATLAB R2023a. ZOA showed an improvement of 18.5 % with a peak overshoot of 0.01 % during the system-transient condition. Compared to conventional optimization algorithms implemented in AVR systems, ZOA provides faster responsiveness and enhanced system stability.