In the current research, a novel algorithm is proposed for the optimal fabrication of a resonant piezoelectric excited millimeter-sized cantilever (PEMC) sensor. PEMC sensor is one of the most well-known types of sensors with a wide range of applications in today’s industry. The proposed design mechanism is general, and can be used for the fabrication of PEMCs for different applications. A physics-based analytical model based on Euler–Bernoulli theory is adopted for performance analysis. A novel hybrid nature-inspired optimizer, called $$\upvarepsilon $$ -constraint lexicographical ranking differential evolution mutable smart bee algorithm ( $$\upvarepsilon $$ lr-DEMSBA), is developed which can effectively search the non-convex and multimodal solution domain. The optimal values of PEMC design parameters are obtained using $$\upvarepsilon $$ lr-DEMSBA. To ensure the veracity of the parameters suggested by $$\upvarepsilon $$ lr-DEMSBA, a PEMC is fabricated using the suggested optimal values, and some post analysis are carried out. By investigating the relation between the frequency shift of natural frequency and increasing of immersion depth, it is observed that the linear performance zone of optimized PEMC sensor is increased by 2.5 mm which is a favorable property. Also, from numerical viewpoint, it was observed that $$\upvarepsilon $$ lr-DEMSBA surpasses different variants of optimization techniques for the current case study.