Physical layer security (PLS) has been extensively explored as an alternative to conventional cryptographic schemes for securing wireless links. Of late, the research community is actively working towards exploiting cooperative communication techniques to further improve the security. Many studies are showing that the cooperation between the legitimate nodes of a network can significantly enhance their secret communications, relative to the non-cooperative case. Motivated by the importance of this class of PLS systems, this paper provides a comprehensive survey of the recent works on cooperative relaying and jamming techniques for securing wireless transmissions against eavesdropping nodes which attempt to intercept the transmissions. First, it provides a in-depth overview of various secure relaying strategies and schemes. Next, a review of recently proposed solutions for cooperative jamming techniques has been provided with an emphasis on power allocation and beamforming techniques. Then, the latest developments in hybrid techniques, that use both cooperative relaying and jamming, are elaborated. Finally, several key challenges in the domain of cooperative security are presented along with an extensive discussion on the applications of cooperative security in key enablers for 5G communications, such as non-orthogonal multiple access (NOMA), device-to-device (D2D) communications, and massive multiple-input multiple-output (MIMO) systems.