(Reuters) - Shares in solar companies including Sunrun Inc (>> Sunrun Inc) and SunEdison Inc (>> Sunedison Inc) rose sharply on Tuesday as investors bet on an extension beyond 2016 of current investment tax credits.

The solar industry was also boosted Tuesday by a California Public Utilities Commission proposal to continue solar customer credits for electricity they contribute to the utility grid. (http://bit.ly/1P5tGGP)

Shares in SunEdison rose 12.6 percent to $5.05. Sunrun shares rose 4.3 percent to $9.49 after rising to $11.29.

Federal tax credits - which boost residential and commercial installations - are under negotiation as part of an end-of-year, must-pass bill to fund the government through September 2016. Votes are expected on the legislation on Thursday.

Investors are growing optimistic lawmakers would agree to an extension, said Stephen Byrd, solar analyst at Morgan Stanley. Kevin Walenta, portfolio manager of the Fidelity Select Environment and Alternative Energy Portfolio also cited reports of potential consensus in Washington as a boost to solar shares.

"If the ITC (investment tax credit) is not extended, we see a fairly significant shakeout among competitors where only the largest companies will be profitable in 2017," said Byrd. "In some ways it's good in that it would shake out competitors, but margin numbers would come down."

Byrd sees companies such as Sunrun and SolarCity Corp (>> SolarCity Corp) continuing to grow profitably in 2017 even if the tax credit is reduced, while smaller private companies could have a tougher time. Byrd is restricted from commenting directly on SunEdison due to its pending Vivint Solar Inc (>> Vivint Solar Inc) deal.

"If you don't get the tax credit (extension) that might push out the investment until costs come down. You might see less near term spending," said Fidelity's Walenta.

Solar shares have been hurt by uncertainty over whether tax credits of 30 percent for commercial solar installations would be extended beyond 2016 or cut to 10 percent. Residential credits would expire without an extension.

Solar shares have also been hurt by falling crude oil prices though analysts say tax credits would have a much bigger impact.

Shares in SunEdison, which has also been hit by financial uncertainties, have fallen 77.5 percent year-to-date while SolarCity shares have fallen 22.2 percent and Sunrun shares have fallen 15.5 percent.

SolarCity shares fell 3.7 percent on Tuesday to $40.05 after it announced an amendment to its credit agreement.

While both should grow without an extension, investors may favor Sunrun's cost reduction prospects, Byrd said.

Sunrun's cost for producing each watt of electricity fell to $3.75 in the third quarter from $4.36 in the first quarter, according to Byrd, who said SolarCity expects its cost per watt to fall from $2.84 in the third quarter to $2.50 in 2017.

SunPower Corp shares rose 4.9 percent to $24.42. Terraform Power Inc (>> TerraForm Power Inc) , which operates SunEdison's power generation assets, rose 2.7 percent while Vivint shares rose 4.3 percent.

Solar stocks were also helped by the global agreement announced in France over the weekend to rein in rising greenhouse gas emissions blamed for warming the planet, according to Byrd and Walenta.

(Reporting By Sinead Carew; Editing by Alan Crosby and Tom Brown)

By Sinead Carew