In this paper, we present a robust Partial Differential Equation-based (PDE) control strategy, which can optimally control both distributed energy storage systems and photovoltaic power plants to enhance the stability margins of synchronous generators. The amount of power that is injected or absorbed from each local power source is determined by a coordination layer, which is implemented by solving a constrained optimization problem that minimizes the cost of the controller action by Lagrangian relaxation. The presented nonlinear controller is robust to unknown time-varying delay and uncertainties on measurements. A time delay compensation technique is developed to inject delay-free control signal into the closed-loop system. Lyapunov-based stability analysis shows that all tracking error signals are globally uniformly ultimately bounded. The proposed method is implemented on IEEE 39-Bus Test System to demonstrate the success of proposed control framework in restoring system stability after being subjected to a large disturbance.