Vivint Solar shareholders will receive 0.55 shares of Sunrun for each share held, the companies said in a statement, representing a premium of 10.4% to Vivint's Monday close.
The deal, unanimously approved by the companies' boards, is valued at $3.2 billion including debt.
Sunrun's shareholders will hold about 64% of the combined company, with the rest owned by Vivint Solar's stockholders.
The deal is expected to deliver annual cost savings of about $90 million, the statement said.
Credit Suisse Securities was the financial advisor to Sunrun, while Morgan Stanley and BofA Securities advised Vivint.
Vivint Solar in May reported an adjusted loss of $1.01 per share in its first-quarter results while withdrawing its full-year forecast. Sunrun posted a net loss of 23 cents per share for the same period.
Business Insider reported in April that Sunrun had laid off at least 100 workers and furloughed another 60 due to the impact of the coronavirus outbreak.