It is predicted that the use of unmanned aerial vehicles (UAVs) in communication systems will be more extensive in future generations of wireless telecommunication networks, due to their facilitating advantages. In this paper, a UAV-based wireless communication system is considered in which a UAV is employed as a relay to connect two ground users. These two disconnected users make a communication pair. Our aim is to maximize the minimum achievable information rate for the communication link between the transmitter and receiver, by cooperatively optimizing UAV trajectory and transmitter and source power allocation. Motivated by the above, we formulate the optimization problem. The solving process is complicated because of the non-convexity of the formulated problem. To overcome this difficulty, we convert the main problem to some sub-problems by fixing some constraints and solve them with iterative algorithms such as successive convex optimization and reach the solution for the main problem. Simulation results show the capability of the proposed algorithm.