This research work presents the tri-level optimization framework for the optimal scheduling of grid-connected and autonomous microgrids to diminish power losses and maximize loadability. Since the network's voltage profile depends on the loading level, the flexible load shaping-based demand-side management strategy is incorporated to investigate its impact on microgrid loadability. With the consideration of uncertain parameters related to renewable power generation, load demand, and power loss, voltage limit constraints, the resultant problem is formulated as a stochastic mixed-integer non-linear problem to enhance microgrid loadability and optimize daily operating costs. The interdependency of demand side management program and microgrid loadability is investigated. The seasonal load profiles covering the weekend and weekday loads in winter, summer, and spring/fall seasons are examined in this research work. The enhanced versions of the distribution networks IEEE-33 and IEEE-69 based microgrid test systems are chosen to evaluate the proposed framework in both off-grid and autonomous modes of operation. Simultaneously, the overall customer satisfaction index is evaluated and improved according to the seasonal load profiles winter weekday, winter-weekend, summer-weekday, summer-weekend, spring-weekday, and spring-weekend by 8.68%, 7.97%, 16.7%, 19.62%, 17.14%, 20.50% respectively. The recently reported Whale Optimization Algorithm is adopted to solve the proposed optimization problem, and the obtained simulation results are validated by comparing them with popular metaheuristic algorithms. The computational burden on the utility is reduced for optimal scheduling of grid-integrated microgrid to extract maximum power by maintaining network voltage profile.