A cognitive radio network has the capability to detect the channels present in wireless spectrum automatically so that it is possible to perform concurrent communication. The major challenges in cognitive radio networks are relay selection and effective sharing of spectrum. Moreover, when the number of secondary users or relay nodes is augmented in the secondary network, enactment of the network is diminished. To overcome this issue, a new and optimal relay selection technique is proposed in this paper which performs amplification and forwarding in order to perform effective relay selection. In addition, a new particle swarm optimization based spectrum allocation technique is also proposed so that the interference problem is solved by applying spatio-temporal constraints in the decision process of particle swarm optimization. From the experiments conducted in this work, it is observed that the throughput of the network is increased by applying intelligent rules to handle the interfering restrictions. The main advantage of this proposed work is that it performs dynamic management of relay selection and spectrum allocation and increases the throughput and maximizes the signal to interference noise ratio.