In this paper, we consider a two-hop wireless sensor network (WSN) with multiple relay nodes where the amplify-and-forward (AF) scheme is employed. We present strategies to design jointly linear receivers and the power-allocation parameters via an alternating optimization approach subject to global, individual, and neighbor-based power constraints. Two design criteria are considered: The first criterion minimizes the mean-square error (MSE), and the second criterion maximizes the sum-rate (SR) of the WSN. We derive constrained minimum mean-square error (MMSE) and constrained maximum sum-rate (MSR) expressions for the linear receivers and the power-allocation parameters that contain the optimal complex amplification coefficients for each relay node. Computer simulations show good performance of our proposed methods in terms of bit error rate (BER) or SR compared with the method with equal power allocation and to a two-stage power-allocation technique. Furthermore, the methods with neighbor-based constraints bring flexibility to balance the performance against the computational complexity and the need for feedback information, which is desirable for WSNs to extend their lifetime.