American legend Michael Phelps won a 23rd Olympic title in his final race at a Games, as Great Britain took silver in the men’s 4x100m medley relay.
The 31-year-old secured his fifth title of Rio 2016 as he teamed up with Ryan Murphy, Cody Miller and Nathan Adrian to set a new Games record of three minutes 27.95 seconds.
Britain finished 2.71 seconds adrift, with Australia in third.
USA also successfully defended their title in the women’s 4x100m medley.
Kathleen Baker, Lilly King, Dana Vollmer and Simone Manuel clocked 3:53.13 to win USA’s 1,000th gold at a Summer Games.
Phelps, meanwhile, bowed out with 28 Olympic medals to his name.
Murphy set the pace in the first leg of the men’s race, setting a new backstroke world record of 51.85 seconds, as Britain’s Chris Walker-Hebbon finished his stint in sixth.
But a blistering breaststroke leg from 100m gold medallist and world record holder Adam Peaty, whose split was 56.59, saw the fastest qualifiers move into first place.
The Americans regained the lead in the butterfly, as Phelps overtook James Guy, and Adrian held off Duncan Scott in the final straight to give the USA their 16th swimming gold medal in Rio.
With one gold and five silvers, it was British swimming’s most successful Games since 1908.
Earlier, Fran Halsall claimed Britain’s seventh fourth-placed finish of the meet in the women’s 50m freestyle final, before coming in seventh along with Georgia Davies, Chloe Tutton, Siobhan-Marie O’Connor in the women’s 4x100m medley relay.
Subscribe to the BBC Sport newsletter to get our pick of news, features and video sent to your inbox.