Wireless Sensor Networks (WSNs) face the critical challenge of reducing node energy consumption to extend network lifetimes in the presence of uncertainties and external disturbances. This paper proposes an event-based PID controller to minimize power consumption while maintaining required data rates in WSNs. Initially, the system is stabilized using a simple controller. Two structures are considered for this purpose: one based on state feedback control and the other utilizing a PID controller. The event-based PID controller is then developed to improve the WSN system's performance and reduce power consumption. The performance of the event-based PID-controlled system is evaluated for both structures. Results with the first structure show moderate improvements in settling time, overshoot, and error, with values of 9.78 sec, 0, and 9.715, respectively. Subsequently, significant enhancements are observed with the second structure of the event-based PID controller, incorporating a stabilizing PID controller. The results demonstrate a settling time of 0.0924 sec, overshoot of 3.58, and error of 0.01486. To further enhance the controlled system's performance, the Gray Wolf Optimization (GWO) method is applied to fine-tune the parameters (P, I, and D) of the implemented controllers. The application of the GWO algorithm maintains desirable characteristics, with settling time, overshoot, and error values of 7.7527 sec, 0.0358, and 6.4217, respectively. This research offers valuable insights for reducing power consumption and improving the performance of WSNs using an event-based PID controller and GWO optimization.