A Mobile Ad hoc Network (MANET) is a network composed of numerous autonomous mobile nodes. In recent times, the opportunistic network, a type of MANET is gaining a lot of significance among the researchers, as it is capable of communicating with the sink node through an efficient selection of relay nodes. In the opportunistic networks, the node does not seek any knowledge about the network topology as it selects the efficacious relay node for transmission of packets. However, MANET requires nodal information about network topology. In the opportunistic network, the data stockpiled in the packets are transmitted from a source node to a sink node by utilizing relay node opportunistically for every hop. However, this type of communication leads to delayed data delivery with increased hops as a consequence of the unsystematic selection of relay nodes. To overcome these constraints, this article focuses on the selection of optimal relay nodes for attaining faster data delivery, by unveiling the location and by predicting the mobility pattern of the neighbor nodes. Hence, this research paper proposes Particle Swarm Optimization algorithm for the selection of optimal relay nodes by locating the neighbor nodes within an established Inter-Communication Range employing Cartesian based localization technique and by analyzing their mobility pattern using recurrent neural network-long short-term memory prediction model. The results of the proposed methodology are compared with four other existing methods, namely, MaxProp, Spray and Wait, and Epidemic. The comparative results infer that the proposed method is efficient in terms of performance, reduced hops, reduced delay with enhanced packet delivery ratio, and improved overhead ratio. © 2020, Springer Science+Business Media, LLC, part of Springer Nature.