West Indies could have been in bigger trouble but Rashid Khan dropped a sitter at mid-wicket off Zadran when Hope was on five.
West Indies produced a defiant display to beat bottom side Afghanistan by 23 runs in the World Cup at Headingley.
Some late big-hitting from Nicholas Pooran (58 off 43) and Jason Holder (45 off 34, including four sixes) in the middle order helped take the Windies beyond 300 in the final over, the kind of total that has been beyond Afghanistan this tournament.
West Indies and Afghanistan are the second last and last team in the ongoing world cup in the points table.
There is speculation that the veteran Gayle will continue playing after the World Cup like some cricketing version of the Rolling Stones.
He leaves with just six wickets at an average of 69 and an economy of 5.79, and just 105 runs in nine innings.
Gayle was caught behind after a slash against Dawlat Zadran for just seven and remains 10 runs short of Brian Lara's all-time record for the West Indies of 10,348 one-day global runs.
He added, "The future looks bright, with Hetmyer, Hope, Pooran - those guys will carry the flag and make sure West Indies cricket is back to where it belongs". Gayle needed 18 to leapfrog Brian Lara and become the Windies' leading one-day worldwide run-scorer of all-time, only to be dismissed for 7.
Earlier in the day, Jason Holder won the toss and opted to bat first on a good pitch at Headingley.
Afghanistan were left needing their highest score of the tournament to end their 100 per cent losing streak in this tournament.
Afghanistan:Gulbadin Naib (captain), Sayed Ahmad Shirzad, Hazratullah Zazai, Asghar Afghan, Rashid Khan, Mohammed Nabi, Mujeeb ur Rahman, Dawlat Zadran, Najibullah Zadran, Hashmatullah Shahidi, Samiullah Shinwari, Rahmat Shah, Noor Ali Zadran, Ikram Alikhil. Shai Hope and Evin Lewis then stitched an exciting partnership of 88 runs for the second wicket which laid the foundation for the batsmen to come.
For both Afghanistan and the West Indies, the tournament has been a case of so near yet so far. On the other hand, Afghanistan have lost all their eight matches despite some close finishes.
West Indies earlier won the toss and chose to bat first against Afghanistan.
West Indies has underperformed over the past five weeks but will be looking to give 39-year-old star opener Chris Gayle a successful send-off in his last World Cup match.