Farah was looking to add the 5000m title to the 10,000m crown he claimed in London last weekend and complete a distance double for the fifth successive major championship.
Mo Farah had to settle for silver medal in the final race of his track career.
"I thought it might be possible coming down the home straight but my legs didn't have it".
"It's very special.it's been a long journey, but it's been incredible", Farah told BBC Sport.
"It doesn't quite hit you until you compete here until after crossing the line and having a few minutes to myself, you realise this is it".
"I gave it all but I had nothing left at the end", a crestfallen and emotional Farah said.
He finished second in Thursday's 5,000m heat in 13 minutes 30.18 seconds, behind Ethiopia's Yomif Kejelcha.
Farah is due to retire from the track at the end of the month, after the Diamond League final in Zurich, to focus on the marathon. Even so, with 10 golds and two silvers at global competitions, he must be regarded as Britain's most prolific athlete.
Farah rarely looked troubled as he ran the race extremely well from a tactical perspective, with none of his fellow runners really forcing him to run hard from the off.
Chelimo fell with four laps to go on the wet track in Wednesday's semifinals but came back and qualified.
The 34-year-old, whose winning run in the 5,000m at Olympics and world finals stretched back to 2011, fought desperately to claw back the deficit in the finishing straight but Edris held on to win in 13min 32.79sec.
"I was trying to cover every move but they had a game plan - one of them was going to sacrifice himself and that's what they did and the better man won".
Mo Farah wins silver in the 5 000m.
Farah, a two-time double world champion and two time double Olympic champion, finished in 13:33.22 just failing to repeat his memorable Olympic double on the same track in 2012.