Media playback is not supported on this device
The Northern Irishman came third on 5-2 favourite Box Office in his final race, won by 9-1 shot Brother Tedd.
McCoy, 40, had earlier finished third on Mr Mole behind winner Special Tiara in the AP McCoy Celebration Chase.
An emotional McCoy said: "It's amazing. I've been so lucky all my life. I'll never forget this day."
McCoy, who has ridden more than 4,300 career winners, added: "I want to thank everyone for coming. All my family were here and it's very special. An unbelievable day I'll never forget.
"There were tears coming back on Box Office. There were nearly tears going out on Box Office.
"I feel very lucky I have ended my career in one piece."
Discussing his record-breaking career, he added: "Someone's going to ride more winners than me. All records get broken. I hope I'm dead, though."
Jockeys formed a guard of honour amid huge cheers as the rider was honoured at the Surrey track.
Colleagues lifted the Arsenal supporter as he collected the champion jockey's trophy for a 20th and final time, from former Gunners striker Ian Wright.
The terraces around the parade ring were packed as a capacity crowd of more than 18,000 gathered, and a rendition of "For he's a jolly good fellow" rang around the stands.
Wright paid tribute, adding: "AP McCoy is made of something else altogether. For 20 years he has been at the top of his game, riding winners, week in, week out. I can think of no other sportsman or woman who can match his record."
McCoy has ridden in more than 16,000 races and suffered an estimated 1,000 falls in a remarkable career.
He did not compete in the feature race, the Bet365 Gold Cup, which was won by 17-year-old jockey Sean Bowen on Just A Par.
Bowen, tipped as a potential future champion, was completing a double on the day after victory on Lil Rockerfeller in the opener.
But there was a sad note to the afternoon for Just A Par's trainer Paul Nicholls when Rolling Aces died following the second race after collapsing on the walkway when returning afterwards.

Following an eighth-placed finish in 2015, Swansea endured a run of just two wins in 17 Premier League games before Francesco Guidolin was named as their new head coach on 18 January.
Salomon Rondon's last-gasp equaliser on Tuesday denied them a win at West Brom.
"We might have [not have] won, but I definitely think we are seeing the old Swansea again," Sigurdsson said.
"We are playing much better than we were. Things weren't good [earlier this season].
"We weren't playing well and keeping the ball like we used to - that's hopefully changing now."
Swansea were in unfamiliar territory after the departure of former boss Garry Monk on 9 December and the playing squad faced criticism.
But after Tuesday's 1-1 draw, Baggies' Welsh boss Tony Pulis believes the Swans have enough quality to avoid relegation from the Premier League this season.
"When in possession, they pass the ball so well and could have scored two or three goals," Pulis said.
"I think Swansea have too much quality to not stay up."
Sigurdsson, the Swans' goal-scorer at the Hawthorns, is currently on his best run of goal-scoring form since his initial loan spell at the Liberty Stadium in 2012, scoring in four of his five appearances so far in 2016.
And the Iceland international felt the Swans had done enough to earn a third straight win on Tuesday.
"It feels a bit like a defeat, to lead coming into the last few minutes," Sigurdsson added.
"We played really well, until the last few minutes. But if you'd have offered us seven points from our last three games, we'd have taken that."
Swansea currently lie in 16th place in the Premier League table ahead of home clashes with Crystal Palace and Southampton.
AP McCoy missed out on a winner but was saluted by a sell-out crowd as the 20-time champion jockey ended his racing career at Sandown.
[NEXT_CONCEPT]
The "old Swansea City" are back after earning seven points from three games, says midfielder Gylfi Sigurdsson.