Optimal power allocation in a multi-hop cognitive radio network is investigated. Information transmitted from the source passes through several wireless relay nodes before reaching the destination. At each hop, the received signal is decoded, re-encoded and retransmitted to the following node. Transmissions at every hop are overheard by nearby nodes and therefore cause interference. We study optimal power allocation strategies that maximize the end-to-end throughput of the network under the constraint of strictly limited interference to external users. We show that for networks that can be modeled as a line topology the optimal solution is achieved when the capacities of every intermediate link are equal and the interference power constraint is satisfied with equality. High- and low-SNR approximations that simplify the problem of finding the optimal power allocation are presented as well. The numerical results show good performance compared to schemes with equal power allocation.