In this paper, we propose a spectrum sharing mechanism with a two-phase two-way relaying protocol for an overlay cognitive network. The system comprises two primary
users (PUs) and two secondary users (SUs). One of the SUs acts as a relay for the PUs and gains spectrum sharing as long as he respects outage probability constraints of the primary
system. Moreover, we consider that the relaying node performs an optimal power allocation scheme that minimizes the outage performance of the secondary receiver. Closed form expressions for the outage probability are derived for the cases of Decode-and-Forward (DF), Amplify-and-Forward (AF), and adaptive relaying. Numerical simulations are presented to illustrate and compare the obtained results.