United States' women claim women's 4x100m medley relay gold ©Getty Images

United States brought the curtain down on Rio 2016 swimming competition here tonight with two emphatic medley relay victories.

One brought the US its 1,000th all time Olympic gold medal and the other produced Michael Phelps' 23rd all-time title on sport's biggest stage.

It was a fitting end to a week in which the country has won 16 of the 33 gold medals available. 

Kathleen Baker put the US in front after the opening backstroke leg of the women's event.

Individual 100m breaststroke winner Lilly King was then overhauled by arch-rival, Russia's Yuliya Efimova, before the US superiority told in the second half of the race.

Dana Vollmer and then Simone Manuel powered the quartet into the lead to claim gold number 1,000 in 3min 53.13.

Australia paced their effort well to finish second in 3:55.00. Just one hundredth of a second clear of Denmark, who took an excellent bronze.

It was a similar story in the men's event.

Double backstroke champion Ryan Murphy broke the eighth world record of the meet in the opening leg, clocking 51.85sec to eclipse the previous mark of 51.94 held by fellow countryman Aaron Peirsol.

United States celebrate medley relay gold in the final pool race of the Olympics ©Getty Images
United States celebrate medley relay gold in the final pool race of the Olympics ©Getty Images

Cody Miller was then overhauled by another stupendous swim by Britain's 100m breaststroke champion Adam Peaty.

That simply provided more impetus for Phelps, however, to chase down James Guy before passing over to Nathan Adrian to complete the job in style in an Olympic record 3:27.95.

Britain hung on for a fine silver in 3:29.24 and Australia took bronze in 3:29.93.

A wait of almost an hour followed for the medals ceremony but when it came Phelps was crowned champion for the 23rd - and probably final - time.

The US did not have it all their own way tonight, however.

Pernille Blume claimed a surprise Danish gold medal in the 50m freestyle before adding a relay bronze.

She clocked 24.07 in the one lap event, just two-hundredths of a second outside the Olympic record, and two hundredths ahead of US rival Manuel.

It was her country's first gold medal of Rio 2016.

Aliaksandra Herasmenia took the bronze medal in 24.11.

Pernille Blume claimed Denmark's first gold medal of Rio 2016 in the 50m freestyle ©Getty Images
Pernille Blume claimed Denmark's first gold medal of Rio 2016 in the 50m freestyle ©Getty Images

At the other end of the distance scale, Italy's Gregorio Paltrinieri dominated the 1500m freesstyle from the start, swimming inside world record pace until the closing stages.

He finished in 14:34.57, more than three-and-a-half seconds outside the mark set by Sun Yang of China at London 2012.

Sun, on this occasion, had been eliminated in the heats, supposedly struggling with the after-effects of a fever.

Conor Jaeger took US silver in 14:39.48 and there was bronze medal for another Italian in Gabriele Detti in 14:40.86.