Cooperative Filtering algorithm is one of the most successful technologies in the application of personalized recommendation system. However, the users’ identities and interests are very complicated in the normal network, which results in the inaccuracy of the recommendation. However, the appearance of social network provides users with a relatively green and safe communication platform. This paper in terms of the problems in the personalized recommendation system of social network comes up with the trust-based nearest neighbor algorithm which optimizes the traditional NN algorithm and provides recommendation by analyzing trust between the social network users. The experimental results show that the modified algorithm greatly improves the recommendation accuracy and raises the users’ degree of satisfaction.