Energy efficiency techniques is a important subject for Wireless Sensor Networks (WSNs), that have received extensive attention from academic and industrial societies to reduce energy consumption and improve network lifetime. The network coding methods is one of the techniques that can help to improve some issues of WSNs such as load balancing, reliability and lifetime. This paper proposes a coding solution as an algorithm for reducing energy consumption in WSNs to prolong the lifetime. Simulation results show that the proposed algorithm increases network throughput and energy efficiency.