Natural gas is already on the cusp of being dominant in electric generation, and with the massive retirements of coal forced by MACT and CO2 regulations, NG will take the top spot absolutely by 2015.
I don't see anything likely to change that by 2040. People tend to forget how expensive generation capacity is, and how much of it we've built over the decades. Just in the three northeast power pools (PJM, NY, New England), we've got about 220,000 MW of generation. In round numbers, that's $400 billion of capital. We don't throw away asset bases like that lightly.
In 2013, electricity generation in the US had the following sources:
Coal: 40%
Natural gas: 26%
Nuclear: 20%
Hydro: 7%
Other Renewables: 7%
And that's just electric generation; if you add in transportation and other primary energy, fossil fuels have an even bigger role. We might all want a lot of renewables in the future, but don't underestimate the inertia of trillions invested in the fossil-fired infrastructure.