In cooperative communication the effect of channel fading can be improved by cooperation between the user terminals and the relay nodes in wireless networks. In a Wireless Sensor Network (WSN), cooperative relaying improves the link quality with a relatively high Energy Efficiency Gain (EEG). In this paper, optimized parameters are used in WSN to enhance the EEG using particle swarm optimization (PSO) and Real-Coded Genetic Algorithm (RGA). Maximum enhancements of EEG obtained using RGA for M-ary Quadrature Amplitude Modulation (M-QAM) is 64% for M=16, 87% for M=32, and 97% for M=64 compared to EEG obtained without optimization. The superiority proposed optimization methods are verified by comparing with results without optimization and by comparing with the published results for Energy Efficiency (EE)