LONDON — Michael Phelps spent the day thinking about all the things he’s doing for the final time at the pool. It turns out that included one last win over Ryan Lochte.

Phelps finally got a gold all his own at his final Olympics.

Adding to an already unprecedented medal collection, he claimed his first individual victory of the London Games and handed Lochte a double disappointment on his rival’s final night in the pool Thursday.

Phelps set the tone right from the start with a dominating butterfly leg to become the first male swimmer to win the same individual event at three straight Olympics in the 200-meter individual medley. He claimed his 20th career medal — and 16th gold — in 1 minute, 54.27 seconds, just off his winning time in Beijing but still good enough for gold, ahead of Lochte.

When it was done, there wasn’t that water-pounding celebration we’ve seen so many times from Phelps — just a slight smile as he hung on the lane rope, gazing up at the stands and soaking it all in.

“Going into every call room, I said it’s my last semifinal or my last prelim,” Phelps said, reflecting on a busy day that included a morning swim, then two more races in the evening. “We’re kind of chalking up all the lasts of certain things.”

As he powered to the wall, his mom Debbie screamed, “Go! Go! Go!” When Phelps touched first, she dropped her head, kissed her two daughters — both former swimmers — and let the tears flow.

When Phelps stepped on the medal podium — yep, that familiar top rung — his eyes were glassy and he whispered a joke to Lochte, trying to keep the moment light. Then, staring up at the U.S. flag while the national anthem played, Phelps bit his lip and seemed to be struggling to hold back his own tears.

Phelps has never been too revealing with his emotions away from the pool.

But, with just two days to go in his swimming career, there’s a definite chink in the facade.

He’s starting to look as human out of the water as he seems superhuman in it.

“To be able to win the gold medal and be the first to threepeat, it means something,” said Phelps, whose first gold in London was swimming the anchor on the 4x200 freestyle relay. “It’s pretty special and something that I’m very happy for.”

So a farewell games that started as a bit of a disappointment is definitely looking up. He’s now won two golds and two silvers in five races — not the eight golds in China, but a more-than-fitting capper to a brilliant career that still has two more races to go: the 100 butterfly Friday and the 4x100 medley relay Saturday.

Lochte settled for silver in 1:54.90, having split with Phelps in their two head-to-head races in London. Hungary’s Laszlo Cseh took the bronze, well behind the Americans in 1:56.22.

“Ryan and I have had a lot of great races,” Phelps said. “He has brought the best out of me many times.”

Ever the competitor, Phelps had hoped to go even faster, looking to not just win gold but take down Lochte’s world record of 1:54.00 from last year’s world championships.

“I wanted to push the first 100 as much as I could just to kind of see what would happen,” Phelps said. “Somebody told me with like 25 to go I was under world-record pace, so it was kind of frustrating I fell a little short.”

When Phelps was done with Lochte, he hopped out of the pool and dashed to the nearby diving well to warm down, preparing for a semifinal of the 100 fly. He was the top qualifier in that one at 50.86 — more than a half-second ahead of South African Chad le Clos, who upset Phelps in the 200 fly, and setting up an additional rematch with Milorad Cavic, the outspoken Serbian who still seems to think he got to the wall first when he lost to Phelps by a hundredth of a second four years ago.

Cavic is talking a different game now.

He doesn’t think he — or anyone else — has a chance against Phelps in the last individual race of his Olympic career.

“Phelps is out of our league,” Cavic said. “It’s not fair that I’m talking for everybody, but I’m expecting something special tomorrow. I think he’s going to go 50.5.”

Lochte went through the same warm-down routine in the diving pool as Phelps, trying to pull off an impressive double 31 minutes apart. He came up short in both races, fading to bronze in the 200 backstroke behind fellow American Tyler Clary, then touching after Phelps in the medley.

“I wanted to get all golds in my events, but you know it didn’t happen,” Lochte said. “I’m going to have to live with that and move on and learn from it. Try not to make the same mistakes in the next four years.

“For the most part,” he insisted, “I’m pretty satisfied.”

Lochte, who intends to keep swimming through Rio in 2016, shook hands with his rival before crawling out of the pool for the last time at these games. In a symbolic gesture, he tossed his cap and goggles into the crowd, his work done. His final tally: two golds, two silvers, one bronze and a fourth-place finish — impressive, but undoubtedly shy of what he had predicted would be “my time.”

This time still belongs the Phelps.

At least for a couple more days.

Rebecca Soni made quite a splash, too, on a night dominated by the Phelps-Lochte showdown.

Tearing through the water in her favorite pink suit, Soni set her second world record in as many days to defend her Olympic title in the 200 breaststroke. She finished in 2:19.59, breaking her own mark of 2:20.00 set in the semifinals.

Soni broke into a big smile when she saw the time, racing the clock more than she was anyone in the water. Japan’s Satomi Suzuki took silver, more than a second behind at 2:20.72, while Russia’s Yulia Efimova claimed bronze in 2:20.92.

“I’m so happy,” Soni said. “I can’t believe I did it.”

Ranomi Kromowidjojo carried on the Dutch tradition of producing top sprinters and prevented a red, white and blue sweep of the night, taking the 100 freestyle in an Olympic-record 53.00. Aliaksandra Herasimenia of Belarus claimed the silver in 53.38, while the bronze went to China’s Tang Yi in 53.44.

American teenager Missy Franklin got off to a terrible start — she was last at the turn — and couldn’t rally. She finished fifth, two-tenths off the podium. The other U.S. swimmer, Jessica Hardy, finished last in the eight-woman field.

“I’m really unsatisfied about the time, but a gold medal is a gold medal,” Kromowidjojo said. “I’m really happy with the gold medal.”

In Soni’s victory, South Africa’s Suzaan van Biljon led at the first turn, but the American quickly seized control on the second lap. She was comfortably ahead by the second turn, then turned on the speed.

“It’s been my goal since I was a little kid to go under 2:20,” Soni said. “That’s when my coach told me you’re going to be the first woman to go under 2:19. I’ve been chasing it ever since. I’m just so happy.”

While Lochte couldn’t hold on in the backstroke, it was still quite a night for the Americans. Clary rallied on the final lap to pull off the upset in an Olympic-record 1:53.41. Japan’s Ryosuke Irie also got by Lochte on the final stroke, taking silver in 1:53.78. Lochte’s time was 1:53.94.

“You always have big dreams in your head that you think you might be able to pull off something like that,” Clary said. “The fact that it just came to fruition is something that hasn’t even processed in my mind yet. The fact that I’m now an Olympic champion and Olympic-record holder is something that is very humbling. It’s also very motivating for the next four years.”

Last year, Lochte looked as though he had surpassed Phelps at the top of the swimming world when he captured five gold medals at the world championships. The Floridian didn’t come close to that total at the Olympics, also failing to defend his Olympic title in the 200 back.

Lochte won his first race of the Olympics with a dominating performance in the 400 IM on the opening night of swimming, but that was his biggest highlight. He faded badly in the anchor leg of the 4x100 freestyle relay, leaving the Americans with a silver, and he finished off the podium in the 200 free.

He did join Phelps in picking up a relay gold in the 4x200 free relay, but never really caught up with him when they competed one-on-one.

Nobody did.

“We’ve been racing for eight years now and the rivalry we created has been tremendous for the sport and our friendship,” Lochte said. “I’m going to miss him.”