Advancements in communication and computation, energy storage and renewable generation, along with the recent support of policy makers have been transforming the power grid into the Smart Grid. In this dissertation, we propose an optimized control framework that addresses four major interconnected problems present in today's grid. We develop a fast, low complexity and accurate forecast algorithm that supplies solar energy predictions to the control algorithms. We improve the accuracy by up to 50% as compared to the state of the art solutions. We complement this with an optimal distributed nonlinear battery control algorithm that uses a high-accuracy nonlinear battery model. Our solution reduces the utility bill of an actual building by up to 50%, a 25% improvement over heuristic solutions. Furthermore, we show that state of the art linear optimal control algorithms incur up to 250% higher costs due to model inaccuracies accumulated over time. We develop a smart grid simulator, S2Sim, that enables the co-simulation of distributed control algorithms. Using S2Sim we show that our battery control algorithm can improve the stability of the grid by up to 45%. Finally, we develop an optimal packet aggregation solution that can optimize individual goals, such as information freshness or energy, in a network-wide manner. We show through case studies that our solution has constant performance under increasing congestion, reduces energy consumption by up to 60%, increases information freshness by up to 55% and adapts to dynamic conditions in real-time, an important quality for distributed control in future Smart Grid applications.