In recent decades, Renewable Energy Sources (RES) have become more attractive due to the depleting fossil fuel resources and environmental issues such as global warming due to emissions from fossil fuel-based power plants. However, the intermittent nature of RES may cause a power imbalance between the generation and the demand. The power imbalance is overcome with the help of Distributed Generators (DG), storage devices, and RES. The aggregation of DGs, storage devices, and controllable loads that form a single virtual entity is called a Virtual Power Plant (VPP). In this article, the optimal scheduling of DGs in a VPP is done to minimize the generation cost. The optimal scheduling of power is done by exchanging the power between the utility grid and the VPP with the help of storage devices based on the bidding price. In this work, the state of charge (SOC) of the batteries is also considered, which is a limiting factor for charging and discharging of the batteries. This improves the lifetime of the batteries and their performance. Energy management of VPP using the teaching-and-learning-based optimization algorithm (TLBO) is proposed to minimize the total operating cost of VPP for 24 hours of the day. The power loss in the VPP is also considered in this work. The proposed methodology is validated for the IEEE 16-bus and IEEE 33-bus test systems for four different cases. The results are compared with other evolutionary algorithms, like Artificial Bee Colony (ABC) algorithm and Ant Lion Optimization (ALO) algorithm.