The government says it is imperative the bill becomes law before the recess
A bill to "clean up" Parliament in the wake of the expenses scandal has been passed by MPs but only after ministers lost a vote on a key issue.
MPs rejected by 250 votes to 247 a clause in the Parliamentary Standards Bill that could allow their debates to be used in court as evidence.
Senior Commons official Malcolm Jack had said it could have had a "chilling effect" on MPs' freedom of speech.
Justice Secretary Jack Straw said ministers would "respect" the decision.
More than 20 Labour MPs rebelled over the clause, including former Cabinet ministers John Reid and Margaret Beckett.
But the controversial bill, the centrepiece of which is a new system of external regulation for MPs expenses, later cleared the Commons and will now move on to the House of Lords.
A Conservative amendment calling for the proposed legislation to be automatically reviewed in a year's time was defeated by 59 votes.
Earlier in the day, the cross-party justice committee had advised that the clause on "parliamentary privilege" be dropped and several MPs raised concerns about it during Wednesday's debate.
The committee had heard evidence from senior Commons official Malcolm Jack warning of a potentially "chilling effect" of the clause on MPs' freedom of speech - and that of witnesses giving evidence to committees.
In its report it said withdrawing the clause "would allow more measured consideration of issues of privilege than has been possible" in the tight Parliamentary timetable.
The clause would allow Parliamentary proceedings to be used in court against an errant MP, breaking the long standing right to Parliamentary privilege.
Following the defeat, Mr Straw made it clear government ministers in House of Lords - which will start considering the bill next week - would respect MPs' decision on the issue.
"Why would I wish to carry on and pursue an unpopular clause unless it was felt to be necessary?" he said.
For the Conservatives, Shadow Foreign Secretary William Hague said ministers would have spared themselves the defeat if they had "consulted properly" on the measure and "done their homework in advance".
The government wants the bill to be law by 21 July when Parliament breaks up for its summer recess.
The main feature of the bill - the establishment of a new Independent Parliamentary Standards Authority to oversee expenses claims and to recommend sanctions for MPs who break the rules - enjoyed wide support but many MPs were concerned by other proposals.
Several argued the bill was being rushed through in response to the expenses crisis when it raised a series of important constitutional questions.
Veteran Tory MP Sir Patrick Cormack said the Commons was "seething with anger" that a bill of such "monumental importance" had been given so little time for debate.
One proposal, for a legally enforceable code of conduct for MPs, had already been dropped in the interests of "consensus", in an effort to get the bill through.
But the government won another crucial vote to keep three planned criminal offences specifically for MPs who break the rules.