Minimizing energy consumption is one of the major challenges in wireless sensor networks (WSNs) due to the limited size of batteries and the resource constrained tiny sensor nodes. Energy harvesting in wireless sensor networks (EH-WSNs) is one of the promising solutions to minimize the energy consumption in wireless sensor networks for prolonging the overall network lifetime. However, static energy harvesting in individual sensor nodes is normally limited and unbalanced among the network nodes. In this context, this paper proposes a modified echo state network (MESN) based dynamic duty cycle with optimal opportunistic routing (OOR) for EH-WSNs. The proposed model is used to act as a predictor for finding the expected energy consumption of the next slot in dynamic duty cycle. The model has adapted a whale optimization algorithm (WOA) for optimally selecting the weights of the neurons in the reservoir layer of the echo state network towards minimizing energy consumption at each node as well as at the network level. The adapted WOA enabled energy harvesting model provides stable output from the MESN relying on optimal weight selection in the reservoir layer. The dynamic duty cycle is updated based on energy consumption and optimal threshold energy for transmission and reception at bit level. The proposed OOR scheme uses multiple energy centric parameters for selecting the relay set oriented forwarding paths for each neighbor nodes. The performance analysis of the proposed model in realistic environments attests the benefits in terms of energy centric metrics such as energy consumption, network lifetime, delay, packet delivery ratio and throughput as compared to the state-of-the-art-techniques.