The British pair lost the quarter-final tie 4-6, 7-6 (2), 10-7 and Murray acknowledged that it could be his last Olympic experience.
The 34-year-old was playing in his fourth Games and won individual gold medals at both London 2012 and Rio 2016.
“I don’t know if I’ll get the opportunity to play again,” he said. “I’ve loved every minute of playing in the Olympics. I wished that today could have gone differently.
“Had another chance with Joe to win a medal, we were so close, and that’s what’s disappointing. I would like to have done some stuff differently in the match to try to help out more. Very disappointed.”
The British pair had been in excellent form through the first two rounds and things seemed to be going smoothly when they broke Cilic to lead by a set and a break.
But the Croatians responded impressively, breaking the Murray serve, winning the second set on a tie-break and then coming through a deciding first-to-10-point tie-break to win the match.
The Scot later tweeted: “I feel crushed after todays loss, sport can be brutal. Thanks so much @joesalisbury92 for the opportunity to play. You were brilliant. I wish it could have gone a little better but sh** happens. And if this is the end of my @olympics journey i want to say a huge thanks to @TeamGB and all the tennis support team for everything they have done to help me perform at my best over the years. It’s been an absolute privilege to represent you and my country at 4 Olympics and it’s given me some of the best memories of my life.”
Murray is the only tennis player in Olympic history to win successive gold medals, and he also has a silver in the mixed doubles with Laura Robson from London 2012.
Given his ongoing struggles to stay fit, which included pulling out of the singles in Tokyo with a thigh strain, it seems highly unlikely he will compete at a fifth Games in Paris in three years’ time.
Murray will now head home for more rest and recovery but is hopeful of being fit for the US Open, starting on August 30.
He said: “I’ll see how the injury heals. That’s what will dictate it. I’m not going to rush something if it’s not there.
“My team think I should be OK to play the US Open judging by how I felt in matches here. It’s not as physical as singles but there’s a lot of explosive movements and my leg felt fine.”
British interest in the tennis came to an end with a third-round loss for Liam Broady in the singles against Jeremy Chardy.
Broady had done brilliantly to make it through to the last 16, upsetting seventh seed Hubert Hurkacz on Tuesday, but Frenchman Chardy proved too strong.
It was another battling performance from 27-year-old Broady as he came from a break down to take the second set, but a 10-minute break before the decider because of the extreme heat refreshed Chardy and he ran out a 7-6 (3) 4-6 6-1 winner.