A microwave-assisted headspace solid-phase microextraction (MA-HS-SPME) approach using a periodic mesoporous organosilica based on alkylimidazolium ionic liquid (PMO-IL) was proposed and used as a greatly porous fiber covering substance for effectively investigating the Stachys lavandulifolia’s essential oil composition. The specimen was exposed to microwave radiation and its volatile constituents were gathered via the fiber from the specimen headspace and straightly inserted into a GC-MS addition port for investigation. A simplex technique was utilized for optimizing three various factors influencing the extraction effectiveness. Under the enhanced circumstances (with the sample weight of 2 g, extraction time of 2.0 min and microwave power of 300 W), the PMO-IL nanoporous fiber could proficiently adsorb volatile components of Stachys lavandulifolia. In optimum conditions, the repeatability for one fiber (n = 3), expressed as relative standard deviation (R.S.D.%), was between 3.5% and 12.1% for the test compounds. The suggested technique, relative to hydrodistillation can equally be used to monitor all the sample components easily, though it will require less sample quantity and duration. A few experiments based on the simplex method proved it would be fast and efficient method to optimize the micro-extraction conditions