With the development of 5G network and big data and the popularity of mobile intelligent devices, the opportunistic social network has been further developed. At present, several existing routing algorithms based on node similarity use the context information of the node to select the best relay node. However, most opportunistic social algorithms only consider the social properties of nodes and ignore the importance of the similarity of the moving trajectories of the nodes. The transmission opportunity of messages in the opportunity social network is generated by the movement of the nodes, so this feature must betaken into account in the designing of the routing algorithm. Therefore, this study proposes a routing algorithm based on the triangular fuzzy layer model and multi-layer clustering for the opportunistic social network. In this study, the authors use the fuzzy analytic hierarchy process model to analyse the social similarity and trajectory similarity to determine the best message transmission node. This study compares the other four opportunistic social network routing algorithms in the simulation environment. In general, among the five routing algorithms, the transmission rate of the TFMC algorithm is the best. The average end-to-end delay and average network overhead are also the lowest.