Wireless sensor networks (WSN) play a significant role in various applications as a communication framework in the field of the Internet of things (IoT). Secure data communication over unsteady wireless connections becomes the main concern in WSN. In order to assure reliable and secure data delivery, numerous research works use authentication-based opportunistic routing protocols. However, it is identified that opportunistic routing protocols are more susceptible to cyber security attacks; particularly, Denial of service (DoS) attacks which causes network failures by disrupting the normal operation of the wireless network. Therefore, in this paper, we propose a novel trust-based routing protocol to safeguard the network from DoS attacks by providing better reliability and authenticity to the wireless channels. The proposed hybrid fuzzy-based Tasmanian devil arithmetic optimization (HFTDAO) algorithm analyzes the historic data information of wireless links and selects the optimal routing channel based on link trust. The novelty of the HFTDAO algorithm is, it utilizes the exploration ability of the Tasmanian devil algorithm and the exploitation ability of arithmetic optimization to enhance the searching ability of the algorithm; the exploring behavior is mechanically shifted among them by means of the tendency factor. In contrast to existing routing protocols, the proposed trust-based opportunistic routing protocol enhances the effectiveness of data delivery. The utilization of mutual authentication algorithm avoids invalid or unreliable data communication directed by DoS attacks and thus provides better data integrity. Also, the verification scheme performed before data delivery speeds up the isolation process of the DoS attack. The efficiency of the proposed model is compared with the existing techniques in terms of different performance metrics such as using different performance measures including PDR (Packet Delivery Ratio), the number of verifications, end-to-end latency, and control packet overhead. When compared to other approaches, the proposed HFTDAO algorithm has a very high throughput value, DoS attack identification rate, and packet delivery ratio.