Distributed generation and demand-side participation have been widely deployed for secure, reliable and economic power distribution networks. Microgrids have been merged in power systems to meet this increase in distributed generation and to provide more control on the massive demand expansion. This paper presents an optimization model for scheduling and operating a microgrid considering the participation of the end-user customers in the electricity market. Mixed-integer programming is used in the proposed model to procure the minimum operation cost of the microgrid and to apply load shedding (LS) optimization on the local responsive loads. The objective function is described by piecewise linear functions. The proposed model allows the implementation of high number of constraints related to generation units, power exchange with the main grid, energy balance and LS. The operation decisions are based on binary variables that represent the status of the generation units, grid-connection and the responsive loads. Furthermore, the proposed model demonstrates the relationship between pick-up/drop-off rates of the responsive loads and the hourly operation cost of the microgrid. Example studies have illustrated the performance of the optimization model in finding the minimum operation cost with multiple technical and economic constraints.