The four-time Olympic champion ran a valiant race in his final appearance on the track at a major championship but could not quite catch Ethiopia’s Muktar Edris.
Farah, who is planning to turn his attention to road racing, completed the 10,000m/5,000m double at the 2012 and 2016 Olympics, and the 2013 and 2015 worlds.
He claimed the 10,000m title once again last Friday, only to suffer his first loss in a final for 2,176 days on Saturday night in front of another huge London Stadium crowd.
Farah normally takes charge on the final lap but this time, following a tactical affair, he found himself playing catch-up over the final 400m as Edris and his fellow Ethopian Yomif Kejelcha led the way.
It looked at one point as if Farah may not even make the podium but he bravely challenged up the inside in the straight and managed to overhaul two of his rivals.
But Edris kept going strongly and triumphed in 13mins 32.79secs, with Farah second in 13:33:22 and Paul Chelimo of the United States third.
An emotional Farah collapsed on the track after the race but recovered and told the BBC in a trackside interview: “I gave 110 per cent, I don’t think there was anything more I could have done.
“They worked as a team, the better man won.
“It’s amazing to serve my country and win medals for them.”