In this paper, the concept of fractional calculus (FC) is introduced into the sliding mode control (SMC), named fractional order SMC (FOSMC), for the load frequency control (LFC) of an islanded microgrid (MG). The studied MG is constructed from different autonomous generation components such as diesel engines, renewable sources, and storage devices, which are optimally planned to benefit customers. The coefficients embedded in the FOSMC structure play a vital role in the quality of controller commands, so there is a need for a powerful heuristic methodology in the LFC study to adjust the design coefficients in such a way that better transient output may be achieved for resistance to renewable sources fluctuations. Accordingly, the Sine Cosine algorithm (SCA) is effectively combined with the harmony search (HS) for the optimal setting of the controller coefficients. The Lyapunov function based on the FOSMC is formulated to guarantee the stability of the LFC mechanism for the test MG. Finally, the hardware-in-the-loop (HIL) experiments are carried out to ensure that the suggested controller can suppress the frequency fluctuations effectively, and that it provides more robust MG responses in comparison with the prior art techniques.