The integration of the smart grid with the cloud computing environment promises to develop an improved energy-management system for utility and consumers. New applications and services are being developed which generate huge requests to be processed in the cloud. As smart grids can dynamically be operated according to consumer requests (data), so, they can be called Data-Driven Smart Grids. Fog computing as an extension of cloud computing helps to mitigate the load on cloud data centers. This paper presents a cloud–fog-based system model to reduce Response Time (RT) and Processing Time (PT). The load of requests from end devices is processed in fog data centers. The selection of potential data centers and efficient allocation of requests on Virtual Machines (VMs) optimize the RT and PT. A New Service Broker Policy (NSBP) is proposed for the selection of a potential data center. The load-balancing algorithm, a hybrid of Particle Swarm Optimization and Simulated Annealing (PSO-SA), is proposed for the efficient allocation of requests on VMs in the potential data center. In the proposed system model, Micro-Grids (MGs) are placed near the fogs for uninterrupted and cheap power supply to clusters of residential buildings. The simulation results show the supremacy of NSBP and PSO-SA over their counterparts.