In this paper, we study a multiple-antenna two-way relaying (TWR) cognitive radio (CR) system. A space alignment (SA) technique is adopted by the secondary users (SUs) to avoid interference with the primary users (PUs). We derive the optimal power allocation that maximizes the TWR achievable SU sum- rate while respecting the total power budget and the relay power constraints. We also analyze the case in which the relay is able to optimize its gain matrix structure to enhance the SU sum-rate. In the numerical results, we quantify the sum-rate gain of using the SA in the TWR CR and we show that the SU sum-rate is very limited when the relay power is low or the PU power and its resulting interference are high. In addition, we optimize the relay gain using an iterative algorithm and compare between different relay matrix structures.