Wireless Sensor Network (WSN) is generally a category of wireless ad hoc network which has densely populated tiny sensor nodes for observing the changes in the environment. However, the security and limited energy of the sensor nodes are considered as the important issues which affect the performances of the WSN. In this paper, the clustering and secure Cluster Head (CH) selection are obtained using the K-means and proposed Modified Spider Monkey Optimization (MSMO) method. Subsequently, secure routing over the network is achieved by using the MSMO whereas the fitness function of MSMO considers four different values such as trust, residual energy, distance and node degree. Hence, the MSMO avoids the blackhole attacks during the data transmission, which minimizes the packet loss. The proposed MSMO-WSN method is analyzed in terms of Packet Delivery Ratio (PDR), Packet Loss Ratio (PLR), routing overhead and average energy consumption. Additionally, the Secure Routing Protocol based on Multi-objective Ant colony optimization (SRPMA) is used to evaluate the MSMO-WSN. The PLR of the MSMO-WSN method is 3.82% for 2 blackhole attacks, and it is less when compared to the SRPMA.