The government's controversial Housing and Planning Bill, which includes policies such as discounted "starter homes" for first-time buyers and larger rents for higher-earning council tenants under so-called "pay-to-stay" terms, will pass into law after a bruising few months in parliament.

A convoluted battle had ensued between the Lords and Commons over technical changes to the wide-ranging bill over which neither legislative arms could agree. A parliamentary process called "ping-pong" ended after crossbench peer Lord Kerslake dropped the last disputed amendment holding up the legislation. The bill, intended to speed up housebuilding and homeownership, is set for Royal Assent on 12 May.

Peers had been trying to water down some of the bill's key elements, forcing the government to make concessions on certain policies by handing ministers 13 defeats in the House of Lords during its final reading. But Kerslake's amendment could not be resolved between the government and peers, despite the bill having been accepted by MPs in the elected House of Commons.

In the bill, councils will be compelled to sell off their highest-value vacant housing stock to fund the construction of new affordable housing and the extension of Right-to-Buy to housing association tenants. Kerslake's amendment would have required the replacement properties to be of similar proportions to those sold off, but the government rejected this.

"I reiterate what I said yesterday: the manifesto clearly states that the homes sold will be replaced by new homes," said Baroness Trafford, a minister at the Department for Communities and Local Government (DCLG), referring to the Conservative party's 2015 manifesto commitments.

"It does not say that there will be like-for-like replacement because that is not always what communities need. We want to ensure that new homes serve the needs of communities. That is why we want to retain flexibility in the legislation so that the government, working with local places, can facilitate the development of the type of homes that communities need today."

The government invoked its financial privilege over the Lords, a convention where peers back down because their amendments would interfere with fiscal arrangements agreed by elected MPs, and Kerslake withdrew his amendment.

"In the end, any contest between this house and the other place will be an unequal one," Kerslake told fellow peers. "That is as it should be: it is elected and we are not. However, that should not dissuade us from making our case clearly and forcefully on issues that really matter. In this case the matters involved matter a great deal. The underlying concerns about this bill have been about its fairness, its commitment to localism and its deliverability. Most of all it has been about whether it will deliver the additional houses of all types and tenures that this country so desperately needs."

Among measures in the bill are the abolition of new lifetime tenancies for council tenants; so-called "Right-to-Rent", where landlords must conduct immigration checks on their prospective tenants; and allowing housing associations to voluntarily take part in the Right-to-Buy scheme.