In opportunistic networks, a congestion phenomenon may occur if the remaining buffer of a node cannot accept any arrival message. Energy is consumed by dropping the messages stored in the buffer to provide space for new messages. In order to reduce and balance the energy consumption of nodes during congestion in opportunistic networks, a novel congestion control scheme is proposed. Nodes dynamically update their residual energy level and query the residual energy level of their neighbors in current local environment and adjust their threshold ratio using the learning automata principle while moving around. Nodes will only receive messages whose remaining TTL (time to live) proportion of initial TTL is larger than the threshold ratio when congestion occurs. Simulation results show that the Epidemic routing protocol with the proposed congestion control scheme can efficiently reduce and balance energy consumption among nodes. Also, the routing performances such as delivery ratio, overhead ratio, and deliver latency are improved. Furthermore, the network lifetime is obviously improved since much more energy is left. © 2016 Institute of Electrical Engineers of Japan. Published by John Wiley & Sons, Inc.