In the network field, Wireless Sensor Networks (WSN) contain prolonged attention due to afresh augmentations. Industries like health care, traffic, defense, and many more systems espoused the WSN. These networks contain tiny sensor nodes containing embedded processors, Tiny OS, memory, and power source. Sensor nodes are responsible for forwarding the data packets. To manage all these components, there is a need to select appropriate parameters which control the quality of service of WSN. Multiple sensor nodes are involved in transmitting vital information, and there is a need for secure and efficient routing to reach the quality of service. But due to the high cost of the network, WSN components have limited resources to manage the network. There is a need to design a lightweight solution that ensures the quality of service in WSN. In this given manner, this study provides the quality of services in a wireless sensor network with a security mechanism. An incorporated hybrid lightweight security model is designed in which random waypoint mobility (RWM) model and grey wolf optimization (GWO) is used to enhance service quality and maintain security with efficient routing. MATLAB version 16 and Network Stimulator 2.35 (NS2.35) are used in this research to evaluate the results. The overall cost factor is reduced at 60% without the optimization technique and 90.90% reduced by using the optimization technique, which is assessed by calculating the signal-to-noise ratio, overall energy nodes, and communication overhead.