SHANGHAI -- Michael Phelps kept telling everyone he wasn't in shape at the world championships. Winning seven medals, including four golds, didn't change his mind.
What Phelps didn't do -- and Ryan Lochte did -- was most telling.
Lochte beat Phelps in both of their matchups, and he set the first world record since high-tech bodysuits were banned 19 months ago while winning five golds and a bronze over eight days at the Oriental Sports Center.
China's Sun Yang broke the second world record of the meet Sunday, taking down Aussie Grant Hackett's 10-year-old mark in the 1,500 freestyle.
The Americans' ongoing rivalry promises to make things interesting on the road to next year's London Olympics.
"I don't really think I'm the top dog," Lochte said.
"No matter what the outcome of the end-of-the-year championship meet, right afterwards I knock myself down to the bottom of the totem pole. I have a whole year to work hard, train hard to get back up there to the top."
No doubt Phelps will be there waiting for him.
"This is 2011. It's not 2012, and it's not the Olympic Games," Phelps said. "I've been able to gather more motivation here than I already had."
Both Phelps and Lochte earned gold medals Sunday, when the United States won two other golds and six medals total on the final night.
The American team claimed 29 swimming medals -- 16 gold, five silver and eight bronze -- to greatly improve upon its performance from two years ago in Rome.
There, the United States won 22 medals -- 10 gold, six silver and six bronze -- at the fastest meet in history, with 43 world records set during the peak of the suit frenzy.
"2012 is something they can't wait to get to," U.S. national team director Frank Busch said.
Swimming the butterfly leg, Phelps rallied the Americans from fourth to second before Nathan Adrian held off fast-closing Australian James Magnussen to win the medley relay in 3 minutes, 32.06 seconds.
The Americans were third after Nick Thoman's opening backstroke leg before dropping to fourth on Mark Gangloff's breaststroke leg.
"I actually kind of like going in the water somewhat behind because it gives me a little bit more motivation," Phelps said. "That was fun."
Australia took the silver in 3:32.26, and Germany got the bronze in 3:32.60.
Lochte wasn't included on the U.S. squad for the final relay because he'd raced the grueling 400 IM, winning in 4:07.13 -- a whopping 4.85 seconds ahead of teammate Tyler Clary, who took silver. Yuya Horihata of Japan earned bronze.
"I'm kind of upset because I wanted to go faster," Lochte said.
He also won the 200 IM and 200 freestyle -- beating Phelps in both -- and the 200 backstroke, along with a gold in the 800 free relay and a bronze in the 400 free relay.
"Getting five gold medals is definitely great, but the times that I went, I know I can go a lot faster," Lochte said. "There's a lot of places in my races that I messed up on, but I guess I have a whole other year to make sure I have those perfect swims."
Lochte's world record came against Phelps in the 200 IM, an effort he called his best moment of the meet.
"A lot of people thought that a world record would never get touched after they banned those suits," he said.
Lochte emerged from Phelps' long shadow in Shanghai, a process that began last year when Phelps' training and motivation had clearly waned.
"Ryan is clearly working hard and is clearly in the best shape he's probably ever been in," Phelps said. "That's why he's swimming the way he is."
Phelps pronounced himself "fairly satisfied" with his performance, knowing it was the result of training seriously for just the last eight months.
"I've said this 100 times this week and I'll say it 100 more, to swim fast you got to be in good shape," he said.
In the 1,500 free, Sun was more than two seconds off Hackett's pace with four laps to go in swimming's version of the mile, but he accelerated on the final two laps to finish in 14:34.14, improving on Hackett's mark of 14:34.56 set at the 2001 worlds.
"I was not obsessed with the world record before the final, because I wanted to focus on my plan," Sun said. "My goal is to win the gold."
Hackett's mark was the oldest in the book, the only one to withstand the record deluge during the polyurethane era of 2008 and 2009. Sun is coached by Hackett's former mentor, Dennis Cotterell.
The 19-year-old Chinese also won the 800 free, along with a silver in the 400 and a bronze on China's 4x200 free relay.
"After winning the gold medal, I think more and more people will pay more attention to me," Sun said. "There's no doubt I will feel more pressure, but I'm still young and I don't want to be burdened by gigantic pressures. So next year, I will keep a relaxed mindset so I can handle future races."
Canada's Ryan Cochrane was second in 14:44.46, while Gergo Kis of Hungary finished third in 14:45.66.
In the women's 400 IM, American Elizabeth Beisel won in 4:31.78 -- 2.44 seconds ahead of Britain's Hannah Miley, who touched a hundredth of a second ahead of Aussie star Stephanie Rice for the silver.
Therese Alshammar, the 33-year-old Swedish sprint star, won the 50 free, becoming the oldest world champion in women's swimming. She touched in 24.14 seconds. Dutch teammates Ranomi Kromowidjojo and Marleen Veldhuis claimed the other medals.
In two non-Olympic events, American Jessica Hardy reclaimed the world title in the 50 breaststroke that she lost two years ago during a doping ban, and Britain's Liam Hancock won the 50 back.