Grid-connected and islanding operations of a microgrid are often influenced by system uncertainties, such as load parameter variations and unmodeled dynamics. This paper proposes a novel adaptive higher-order sliding mode (AHOSM) control strategy to enhance system robustness and handle an unknown uncertainty upper bounds problem. Firstly, microgrid models with uncertainties are established under islanding and grid-connected modes. Then, adaptive third-order sliding mode and adaptive second-order sliding mode control schemes are respectively designed for the two modes. Microgrid models' descriptions are divided into nominal part and uncertain part, and higher-order sliding mode (HOSM) control problems are transformed into finite time stability problems. Again, a scheduled law is proposed to increase or decrease sliding mode control gain adaptively. Real higher-order sliding modes are established, and finite time stability is proven based on the Lyapunov method. In order to achieve smooth mode transformation, an islanding mode detection algorithm is also adopted. The proposed control strategy accomplishes voltage control and current control of islanding mode and grid-connected mode. Control voltages are continuous, and uncertainty upper bounds are not required. Furthermore, adjustable control gain can further whittle control chattering. Simulation experiments verify the validity and robustness of the proposed control scheme.