As more and more distributed energy resources (DER) connect to the power grid, ensuring the stability of the power supply is an increasing concern. Accordingly, the present study proposes a hierarchical microgrid operation architecture consisting of an electric vehicle (EV) charging parking lot energy management system (EVCP-EMS) and a smart home energy management system (SHEMS). In the proposed architecture, the EVCP-EMS with 50 spaces minimizes its power demand cost by participating reserve capacity ancillary service market and determines the best charging time to satisfy with every user's vehicle usage. Moreover, the SHEMS processes optimal residential appliance controls with consideration of both economic benefits and user's preferences. The EVCP-EMS and a number of SHEMSs are integrated with an Aggregator to execute the demand response (DR) when distribution system is during emergency situations via advanced metering infrastructure (AMI). The feasibility of the proposed architecture is demonstrated by IEEE 13-node test distribution system. The simulation results show the proposed methods can minimize user's power demand cost. Besides, the problems of reverse power and over-load can be avoided due to the proposed DR strategies. Overall, the results suggest that the architecture proposed in this study represents a feasible solution for distribution system operators and energy service companies to increase customer's benefit and maintain the power supply security.