The existing routing algorithm of Wireless Sensor Networks (WSNs) pays more attention to the energy efficient. However, Quality of Service (QoS) supported and the validity of packet transmission unveil additional challenges. Based on the Particle Swarm Optimization (PSO), this paper presents a trust QoS routing algorithm for WSNs. Hierarchical structure is adopted and the trust value of the node is constructed with the direct trust value and the indirect trust value. In addition, delivery delay and packet loss are considered as main QoS metrics. Finally, under the optimization ability of PSO, the proposed algorithm tries to find the route with maximum residual energy and reliability in order to maximize network utilization as well as meets QoS constraints. Compared to typical routing algorithms in sensor networks, this new algorithm has better performance.