We formulate a three species prey–predator model supplying allochthonous inputs to the top predator in the presence of top predator harvesting. All the equilibria of the system are determined and their stability nature are investigated. With the help of Pontryagin’s maximum principle, fishing effort is used as an optimal controller to investigate the optimal solution. The system dynamics for different values of preference parameter ($$c$$c), catchability coefficient ($$q$$q), allochthonous inputs ($$A$$A) and harvesting effort ($$E$$E) are presented. Bifurcation analysis is done with respect to harvesting and existence of chaos, 2-cycle, 4-cycle, limit cycle and steady state behaviours are observed. The existence of Hopf bifurcation, limit point, limit point cycle, period doubling and branch point are observed in the system. The dynamics of the system in the A–E parameter plane is presented. We observe that predator extinction risk decreases with the increasing of available allochthonous resources in the presence of harvesting. Our results suggest that allochthonous inputs at high levels can stabilize food webs and remove the possibility of species extinction in the presence of harvesting. © 2014, Foundation for Scientific Research and Technological Innovation.