Peer-to-peer (P2P) topology has significant influence on the performance, search efficiency and functionality, and scalability of the application. In this paper, we propose a Particle Swarm Optimization (PSO) approach to the problem of Neighbor Selection (NS) in P2P Networks. Each particle encodes the upper half of the peer-connection matrix through the undirected graph, which reduces the search space dimension. The results indicate that PSO usually required shorter time to obtain better results than Genetic Algorithm (GA), specially for large scale problems.