The Big Night In was watched by an average of 6.7 million viewers, the BBC has said.
The fundraising show gave BBC One a 35% share of viewers, with a peak audience of 8.5 million.
The programme, which featured the first new Little Britain sketch in more than 10 years, a lockdown version of The Trip by Steve Coogan and Rob Brydon, and even included a surprise performance from the Duke of Cambridge, raised more than £27 million for charity.
Wow. What an incredible evening. We are absolutely STUNNED by your generosity and donations to #TheBigNightIn! What a wonderful evening 🥰 But don't forget, it's not too late to still donate to those struggling through this crisis. You can do so here: https://t.co/7eQ9POzhvY pic.twitter.com/f9TnNlNiFx— Comic Relief (@comicrelief) April 23, 2020
All the money will be split equally between Comic Relief and BBC Children In Need to support local charities and projects in the UK as they deal with the coronavirus crisis.
William appeared in a Blackadder sketch alongside Stephen Fry just before the clap for carers took place.
He told the actor and comedian: “On my way, let me just see if I can find my socks, and my shoes, and my trousers.”
The programme also featured a host of musical performances from artists including Gary Barlow, Sam Smith and Celeste.
Smith performed an isolation version of their song Lay Me Down, while Celeste sang a cover of Bill Withers’ Lean On Me.
Foo Fighters also led a star-studded group of musicians including Dua Lipa and Chris Martin in a charity cover of their song Times Like These.
There were also comedy performances from David Tennant and Catherine Tate, Miranda Hart and Dawn French.
A reworked version of the music video for Peter Kay’s (Is This The Way To) Amarillo, which featured members of the public and emergency service workers, was also aired during the programme.
YouTuber Joe Sugg gave his girlfriend Dianne Buswell a lockdown haircut while the programme was being broadcast.
He gave the dancer a drastic makeover, cutting a large chunk of her hair off and spraying it with a hair dye.
In addition to the performances and celebrity appearances, there were also a number of charity appeals during the programme.
Chancellor Rishi Sunak appeared on the show to urge viewers to give generously, saying that the Government would match all donations.
He said: “We are all worried, worried about our health, our friends, our family, but I also know when we look back and remember that in this time of crisis that we came together as a country.
Proud to be matching your donations to #TheBigNightIn pound for pound.— Rishi Sunak (@RishiSunak) April 23, 2020
Share and click below to donate👇
“We were there for each other and that is what the Big Night In is all about.
“I’m so grateful to everyone who has donated tonight, and don’t forget the Government has pledged to match every pound you donate, so please do give generously.”
At the beginning of the programme Sir Lenny Henry, who was presenting the programme, said: “It is important to know you may be at home but you are not alone.”
The programme was a collaboration between BBC Children In Need and Comic Relief and was raising money for the two charities.
Funds raised by the programme are being split equally between the organisations to provide support to local projects and programmes across the UK during the coronavirus pandemic.