This paper focuses on the speed regulation of permanent magnet synchronous motors (PMSM) in electric vehicle application using sliding mode control (SMC). Harris hawks optimizations (HHO) based sliding mode controller is adopted to increase the dynamic response of the PMSM motor, thereby enhancing vehicle performance. For the independent control of torque and flux, field oriented-control (FOC) is used to drive the PMSM. In this work, the speed reference provided for the controller is based on an electric car driving cycle that replicates real-world driving conditions. The optimal selection of sliding mode controller parameter enhances the dynamic characteristics of the speed regulation in electric vehicles, which is validated using the hardware in the loop (HIL-402) device. The HHO based sliding mode controller has superior performance in terms of robustness against load disturbances, fast convergence, and tracking accuracy.