David Cameron was putting on a brave face after the Conservatives failed to break through in the first by-election tests of Gordon Brown's premiership.
Mr Sharma said Labour had not taken Ealing Southall for granted
Labour held on to Ealing Southall and Tony Blair's old Sedgefield seat - but with much reduced majorities.
Lib Dem leader Sir Menzies Campbell, who saw his party take second place in both seats, was the main beneficiary.
Mr Cameron said the Tory share of the vote held up but added: "Obviously I would have liked to have done better."
The results could fuel speculation Mr Brown will opt for an early election to capitalise on the "bounce" he has enjoyed in opinion poll ratings since taking over as prime minister.
The Tories had been hoping to overtake the Lib Dems and even snatch victory in Ealing Southall after choosing a high profile candidate, local radio boss Tony Lit.
Mr Cameron visited the constituency five times during the course of the campaign.
But the party suffered a setback when it emerged Mr Lit's company had donated money to Labour and he had been photographed with Tony Blair just days before his selection.
Mr Cameron told the BBC: "Often in a seat where you are third your vote gets completely squeezed. That didn't happen last night.
"Our vote held up. I think that is because we had a very good candidate, who fought an active campaign."
He added: "Obviously I would have liked to have done better but on to the next battle."
He denied it was a mistake to list Mr Lit as standing for "David Cameron's Conservative Party" on the ballot paper, saying it was just one of the options available to parties.
Labour deputy leader Harriet Harman described the two by-election results as "remarkable" for Labour - despite big swings to the Lib Dems in both constituencies.
"The turnout was down but we are very pleased with the result," Ms Harman told BBC One's Breakfast.
She added: "The other reason why we have a spring in our step is because of what has happened to the Conservatives, because David Cameron actually put his own name on the ballot paper in Ealing and people didn't vote for him."
Sir Menzies Campbell said of the by-election results: "It is a blow to [Prime Minister Gordon] Brown and a disaster for David Cameron.
"The Conservatives have been pushed into a poor third place and proved once again that they are entirely marginalised in the north of England."
In Ealing Southall, Labour's majority fell from 11,440 to 5,070.
The party took 15,188 votes, the Lib Dems 10,118 and the Conservatives 8,230 - a swing of 5.24% from Labour to the Lib Dems. Turnout was 42.95% - down 13.23 points on 2005.
Labour's victorious candidate, Virendra Kumar Sharma, said his victory had been due to "policies" and "not slick PR".
He added: "We never took this area for granted and we will never take this area for granted."
Conservative candidate Tony Lit said: "A race that's always been a one-horse race is no longer a one-horse race."
In Sedgefield, Labour took 12,528 votes, the Lib Dems 5,572 and the Conservatives 4,082, with an 11% swing from Labour to the Lib Dems. Turnout was 41.57% - down 20.65 points from 2005.
The seat was made vacant by former prime minister Mr Blair's resignation as an MP to become a Middle East envoy.
Labour's candidate, Phil Wilson, was one of the Labour activists who talent spotted Mr Blair in 1983, but his 45% share of the vote was 14% down on Mr Blair's haul in the 2005 general election.
Most of the benefit from the swing away from Labour was felt by the Lib Dems and the British National Party, which held on to its deposit with almost 9% of the vote.
Accepting his victory in Sedgefield, Mr Wilson said he was "honoured and deeply humbled" to be elected to the seat where he grew up.
"We have won our victory here tonight because of the success of New Labour under Tony Blair and our renewal with Gordon Brown," he said.
"This election has been a disaster for David Cameron. People know he just can't be trusted when it comes to the big issues."
Lib Dem candidate Greg Stone said: "This has been a fantastic result for the Liberal Democrats. Yet again we have shown we are the only alternative to Labour in the north."
But Tory candidate Graham Robb, who came third but marginally improved his party's share of the vote, rejected the claim.
"It is a good result for us, because we can prove we are still in business in the north-east and as we regenerate our party, we will be back in business even more," he said.
Phil Wilson (Lab) 12,528 (44.77%, -14.11%)
Greg Stone (LD) 5,572 (19.91%, +8.02%)
Graham Robb (C) 4,082 (14.59%, +0.19%)
Andrew Spence (BNP) 2,494 (8.91%)
Paul Gittins (Ind) 1,885 (6.74%)
Toby Horton (UKIP) 536 (1.92%, +0.36%)
Chris Haine (Green) 348 (1.24%)
Stephen Gash (Eng Dem) 177 (0.63%)
Tim Grainger (Ch P) 177 (0.63%)
Alan "Howling Laud" Hope (Loony) 129 (0.46%, +0.08%)
Norman Scarth (Anti-Crime) 34 (0.12%)
Lab majority 6,956 (24.86%)
11.06% swing Lab to Lib Dems
Ealing Southall results:
Virendra Sharma (Lab) 15,188 (41.48%, -7.28%)
Nigel Bakhai (LD) 10,118 (27.63%, +3.19%)
Tony Lit (C) 8,230 (22.48%, +0.91%)
Sarah Edwards (Green) 1,135 (3.10%, -1.52%)
Salvinder Dhillon (Respect) 588 (1.61%)
Dr Kunnathur Rajan (UKIP) 285 (0.78%)
Yaqub Masih (Ch P) 280 (0.76%)
Jasdev Rai (Ind) 275 (0.75%)
John Cartwright (Loony) 188 (0.51%)
Sati Chaggar (Eng Dem) 152 (0.42%)
Gulbash Singh (Ind) 92 (0.25%)
Kuldeep Grewal (Ind) 87 (0.24%)
Lab maj 5,070 (13.85%)
5.24% swing Lab to Lib Dems