WASHINGTON—Mortgage-finance giants Fannie Mae and Freddie Mac are here to stay.

Lawmakers in both parties and the Trump administration are negotiating overhauls of the two companies—critical to home mortgages but in government conservatorship since the financial crisis—that could keep them at the center of the U.S. mortgage market for years to come, abandoning long-stalled proposals to wind them down, people familiar with the matter said.

Bipartisan Senate legislation set to be introduced in early 2018 marks the clearest sign of this reversal and shows how the companies, entering their 10th year under federal control, have proven too risky to attempt replacing. The housing market has seen strong demand in recent years, driven in part by steady access for many Americans to 4% or lower 30-year fixed-rate mortgages, thanks in part to a government backstop of the companies.

Advancing legislation to refashion the nation’s $10 trillion mortgage market is a heavy political lift and may yet sputter during the coming midterm-election year, as a prior Senate effort did four years ago. One big difference this time around: a more incremental approach largely reliant on the existing housing-finance framework.