It is a mystery that gripped the nation. Finally the BBC will reveal how Sherlock Holmes survived falling to his apparent certain death, in a festive TV lineup that will also include the first outing for Peter Capaldi as the Time Lord in the new Doctor Who.

The BBC's Christmas and new year holiday season of programmes, announced on Tuesday, will include PD James' Pride and Prejudice sequel, Death Comes to Pemberley, starring Matthew Rhys as Mr Darcy; an adaptation of David Walliams' children's book Gangsta Granny; and festive editions of Strictly Come Dancing, Call the Midwife and The Great British Bake Off.

The bawdy sitcom Mrs Brown's Boys will be back, as will another BBC sitcom from the gentler end of the spectrum, the return after nearly 30 years of Open All Hours, with David Jason.

But it is Benedict Cumberbatch in the lead role in Sherlock that is most likely to grip viewers' imaginations. Conspiracy theories abound as to exactly how Holmes faked his death after the second series climaxed in January 2012 with the supersleuth's dramatic rooftop plunge.

Since the show was last on BBC1, both Cumberbatch, in the Star Trek sequel Into Darkness, and his co-star Martin Freeman, in The Hobbit, have become established big-screen stars.

The showrunner Steven Moffat said there was a "clue everybody's missed" after Holmes's standoff with his nemesis, Moriarty. Two years later, the puzzle will finally be solved.

Mark Gatiss, who wrote the first episode of the new series of Sherlock, will continue the tradition of a BBC ghost story for Christmas with his adaptation of MR James's The Tractate Middoth, on BBC2.

Other festive dramas will include Martin Sheen in BBC1's The Whale, the story of a US whaling ship sunk by a sperm whale, which inspired Herman Melville's Moby Dick; and Danny Dyer will make his debut as the Queen Vic's new landlord, Mick Carter, in EastEnders on Christmas Day.

The Doctor Who special on Christmas Day will feature Matt Smith's Time Lord regenerating into the 12th doctor, played by Capaldi, as well as the return of the Daleks and the Cybermen, the Silence and the Weeping Angels.

Ben Stephenson, the BBC's controller of drama commissioning, said: "The Christmas episode is heartbreaking and wonderful, a glorious farewell to Matt and an absolutely extraordinary arrival of our new doctor."

Mary Berry and Paul Hollywood will present The Great British Bake Off Christmas Special, in which the pair offer tips for a "stress-free Christmas" (to which the eight million people who watched this year's final would presumably answer: don't try to bake a pretzel).

It will be the programme's last outing on BBC2 before it switches to BBC1 next year; Berry will also offer up some advice for the "perfect Yuletide feast" on a festive Food and Drink.

In the absence of a Top Gear Christmas special, BBC2 will have Jeremy Clarkson telling the story of the Arctic convoys of the second world war in PQ17: an Arctic Convoy Disaster, and his Top Gear colleague James May will attempt to build a motorbike and sidecar entirely out of Meccano to race on the TT circuit on the Isle of Man.

BBC1 will broadcast the First Eucharist of Christmas live from Westminster Abbey, in addition to carols from King's College, Cambridge on BBC2, and the archbishop of Canterbury's new year message on New Year's Day.

Dr Allison Woollard, a developmental biologist from Oxford University, will deliver this year's Royal Institution Christmas Lectures, on BBC4. The channel will also air highlights from the traditional New Year's Day concert from Vienna, a three-part documentary about the city now known as Istanbul with Simon Sebag Montefiore, and the Fir Tree, a Danish film following the life of a Christmas tree, from the perspective of the tree.

Terrestrial TV movie premieres will include the Pixar sequels Toy Story 3 and Cars 2, as well as Johnny Depp in Pirates of the Caribbean: On Stranger Tides, and Ben Stiller and Robert de Niro in Little Fockers.

The singer Elaine Paige, the former Bros star Matt Goss and the DJ Sara Cox will be among the contestants on a festive edition of Strictly Come Dancing. Top of the Pops returns with three shows looking back on 2013, festive hits of the past and a New Year's Eve special.

BBC1 traditionally dominates Christmas Day viewing, with EastEnders last year winning the overnight ratings battle for the fourth year running despite its lowest-rating festive edition for at least a decade.

The BBC did not have it all its own way, with ITV's Downton Abbey and the soap pair of Coronation Street and Emmerdale making last year's festive top 10. Ratings for nearly all of the big Christmas shows were down on the previous year, a further sign of the fragmentation of TV viewing.

• This article was amended on 9 December 2013. The earlier version said The Whale was the story of a US warship sunk by a sperm whale.