Phelps and Lochte both earned a spot in their second event on the American Olympic team that will try to dominate the swimming events next month at the London Games.
Lochte defeated Phelps in their first meeting at these trials Monday in the 400-meter individual medley finals, but Phelps gained revenge Wednesday in yet another thrilling showdown.
Phelps, winner of 14 Olympic gold medals and 16 medals overall, was timed in 1:45.70 -- just .05 of a second in front of Lochte.
Lochte edged Phelps at the wall in Tuesday's semifinals of the 200-meter freestyle at the U.S. Olympic trials.
Lochte touched the wall in Omaha in 1 minute, 46.25 seconds, a mere 2/100ths of a second ahead of Phelps, who won the event four years ago at the Beijing games.
Phelps won a record eight gold medals in China but the up-and-coming Lochte beat him twice in last year's world swimming championships.
Phelps could qualify for as many as 10 events in London and he returned an hour after defeating Lochte to swim in the semifinals of the 200-meter butterfly. Phelps finished with the third-best time among the eight qualifiers for the finals, turning in a time that was almost 5 seconds off his world record.
The other finals held Wednesday were won by Missy Franklin, Matt Grevers and Breeja Larson.
Franklin captured the women's 100-meter backstroke in the American record time of 58.85 with Rachel Bootsma (59.49) earning the second spot on the U.S. team in that race.
Grevers, silver medalist at the Beijing Olympics, won the men's 100-meter backstroke in 52.08. Nick Thoman was second in 52.86.
Larson surprised Rebecca Soni to win the women's 100-meter breaststroke by .07 of a second. Soni won the silver medal in Beijing over 100 meters and was the gold medalist in the 200-meter breaststroke. Larson was timed in 1:05.92.
Phelps needs to win three medals in London to pass Soviet gymnast Larysa Latynina's all-time medal record of 18. She competed from 1956 through 1964.
In other action at the trials Tuesday, Brendan Hansen made the U.S. team for the third time with a 59.68 victory in the in the men's 100-meter breaststroke. Allison Schmitt took first in the women's 400-meter freestyle and Dana Vollmer won the 100-meter women's butterfly.
Ohio crash that killed two caught on camera [VIDEO]
Workers accuse National Zoo of animal mismanagement