The rapid adoption of Electric Vehicles (EVs) with Vehicle-to-Grid (V2G) technology offers significant potential to enhance grid stability, optimize renewable energy utilization, and reduce energy costs within urban MicroGrid (MG). This study presents an advanced energy management system (EMS) designed for an MG that integrates Photovoltaic (PV) generation, stationary storage systems, residential loads, and V2G-enabled EV charging terminals. The proposed strategy implements two optimization approaches, Linear Programming (LP) and a heuristic method, and compares them to a baseline scenario without storage or V2G capability. Simulation results show that combining storage and V2G substantially lowers daily energy costs by increasing PV self-consumption and reducing dependence on the power grid. Under clear weather, V2G reduces daily costs to 731.9 c
/day (LP) and 753.9 c
/day (heuristic), achieving reductions of approximately 12.2% and 11.9%, respectively, compared to the non-V2G cases (833.6 c
/day and 855.5 c
/day). Without storage, the cost increases to 822.5 c
/day (with V2G) and 924.2 c
/day (without V2G), showing the added value of storage systems. On cloudy days, V2G still offers notable savings: 996.4 c
/day (LP) and 1038 c
/day (heuristic), corresponding to reductions of about 9.3% and 8.95% compared to the non-V2G cases (1098 c
/day and 114° c
/day). In the absence of storage, daily costs are higher: 1087 c
/day (with V2G) and 1189 c
/day (without V2G). The findings also highlight that LP consistently outperforms the heuristic method, especially under variable weather conditions, by enabling more accurate energy allocation. Overall, the results confirm that integrating V2G with an optimized EMS significantly improves the economic efficiency, resilience, and sustainability of urban MG, thereby supporting their future integration into smart grids.