Leading Democratic senators and three of the largest U.S. banks are narrowing the scope of legislation that could let troubled homeowners avoid foreclosure through bankruptcy courts, several sources familiar with the negotiations said.

Bank of America , JPMorgan Chase and Wells Fargo & Co are in intense negotiations with Democratic leaders on Capitol Hill, principally Richard Durbin, the Democratic whip in the Senate, with the hope of crafting a deal by early next week, sources said.

At the heart of the negotiations now are the scope, duration and terms of a program that would let bankruptcy judges rewrite loan terms under a program called cramdown.

Under one plan being floated, troubled borrowers must have tried and failed to get relief under President Barack Obama's housing rescue plan to qualify for relief in bankruptcy court.

The cramdown program would be closed to borrowers in high-value homes and would sunset in five years under the proposal under negotiation.

According to this scenario, bankruptcy judges would not be allowed to reduce the principal loan amount but could ease the interest rate or other terms.

There is also a provision on the table for credit unions to increase their small business lending.

The so-called cramdown legislation stalled in the Senate last month after lawmakers failed to line up the 60 votes needed to clear the way procedurally for it to move ahead.

The House of Representatives approved a similar bill in March that would allow bankruptcy judges to cut the mortgage debt of homeowners in bankruptcy court as a last resort to avoid foreclosure.

Seen by Democratic supporters as vital to stabilizing the crumbling U.S. real estate market, the bill has been opposed by many bankers, despite some efforts to limit its scope, including one restricting it to existing primary residence mortgages, not future loans.

The risk with allowing any change to cramdown is the net negative effect on the housing market, which everyone is working to fix, said Scott Talbott, chief of government affairs for the Financial Services Roundtable, an industry group for financial companies.

Many bankers and opponents of the legislation have said the change to bankruptcy law would raise costs for everyone by diverting capital from the mortgage debt market.

Some federal officials have also warned that cramdown legislation could damage the mortgage market because investors did not calculate the risk of bankruptcy when pricing their housing investments.

But Democrats backing the bill discount such fears and say it could sharply cut the high U.S. home foreclosure rate.

Under present law, bankruptcy courts may reduce many forms of debt for struggling borrowers -- loans on boats, cars, vacation homes or family farms -- but not primary residences.

In January, Citigroup said it would support a cramdown mortgage bankruptcy law reform to help troubled mortgage borrowers, but there has been no public wave of support from other financial institutions.

(Reporting by Karey Wutkowski and Patrick Rucker; Editing by Neil Stempleman)