AP Photo/Matt Slocum

Michael Phelps and Ryan Lochte have been swimming with and against each other for 13 years. They square off on Thursday night in the 200-meter individual medley, the last time these two American stars will go head-to-head on the biggest stage.

Phelps is 4-1 against Lochte in Olympic competition and is gunning for an unprecedented fourth straight gold medal in the 200 IM.

Here is a look at some their Olympic head-to-heads:

London 2012:

Phelps and Lochte went 1-2 in the 200 IM, with Phelps becoming the first swimmer to win three straight gold medals in an event when he finished with a time of 1 minute, 54.27 seconds. Lochte was right behind him at 1:54.90.

But Lochte got Phelps in the 400 IM, winning gold with a time of 4:05.18 while Phelps finished a surprising fourth with a time of 4:09.28.

Beijing 2008:

At the height of his powers, Phelps was well on his way to a record eight gold medals when he blew away the field in the 200 IM for his sixth win, setting a world record at 1:54.23. Lochte finished in third for bronze at 1:56.53.

Phelps also won gold in the 400 IM, setting a world record at 4:03.84. Lochte again got the bronze at 4:08.09.

Athens 2004

Phelps set an Olympic record in the 200 IM with a time of 1:57.14. Lochte took home silver at 1:58.78