In this paper, the optimal power allocation problems are solved for hybrid distributed beamforming in wireless relay networks. The capacity of the source-destination link is maximized and the total transmit power of the source and the relays is minimized. The hybrid relaying which adapts relaying strategies such as amplify-and-forward (AF) and decode-and-forward (DF) to the channel condition can enhance the signal reliability. Three policies are used to determine the ordering of the relays for switching the relaying mode from AF to DF. Simulation results show that the performance of the proposed scheme is nearly optimal for both capacity maximization and power minimization with a few iterations.