The optimal system design based on maximizing the Energy Efficiency (EE) is investigated for the multi- pair massive Multiple-Input Multiple-Output (MIMO) relaying system. By virtue of the law of large numbers, an analytical expression of the involved EE function is derived with respect to the transmit power at the users and the relay, and the antenna number of the relay, when the Maximum Ratio Combining Maximum Ratio Transmission (MRC/MRT) precoding is adopted at the relay. The existences of a unique globally optimal transmit power vector and a unique globally optimal antenna number at relay are demonstrated separately by exploring the properties of the EE function. In order to obtain the optimal transmit power vector, the original fractional optimization problem is first transformed into an equivalent subtractive form by using the properties of fractional programming. Then, a low-complexity iterative algorithm is developed and the closed-form solution is deduced. Regarding the optimal number of relay antennas, a closed-form solution is also achieved by use of the Lambert W function. Numerical simulations show that the proposed power optimization algorithm converges to a near optimal solution only with a few numbers of iterations and the provided closed-form solution to the optimal number of relay antennas is also accurate. © 2017, Science Press. All right reserved.