Electric vehicles (EVs) are gaining increasing popularity worldwide due to their significant benefits in energy conservation and emissions reduction. In this paper, we present a novel algorithm to achieve peak shaving and valley filling in the power grid through the utilization of EV charging and discharging, within the framework of demand response. The proposed algorithm utilizes Vehicle-to-Grid (V2G) technology to exploit the flexibility of EV charging and discharging and to ensure that the planning of EVs is not compromised. To address this problem, we employ a distributed Alternating Direction Method of Multipliers (ADMM), which not only ensures the privacy of EV users but also exhibits scalability and low computational requirements for aggregators. Through simulation results, we demonstrate the algorithm’s effectiveness in achieving grid power peak shaving and valley filling, thus relieving the pressure on the grid.