By Sam Forgione

NEW YORK (Reuters) - Two major U.S. stock indexes set fresh record closing highs on Thursday on investors' optimism about big banks' second-quarter earnings, while European shares also rose and oil prices rebounded from the previous session's bruising losses.

Expectations of more stimulus from the Bank of England and Bank of Japan have contributed to stocks' gains in the past week. The view that the U.S. economy is on solid footing, as well as reduced political uncertainty in Britain and Japan, have also buoyed stocks.

The benchmark S&P 500 ended at 2,163.75, its fourth straight record closing high after hitting a record intraday peak of 2,168.99. The Dow Jones industrial average closed at 18,506.41, its third straight record close after touching a record intraday high of 18,537.57.

JPMorgan, the biggest U.S. bank by assets, reported stronger-than-expected quarterly revenue, sending its shares up 1.5 percent into the close and boosting the S&P financial index 0.89 percent.

The pan-European STOXX Europe 600 and the FTSEurofirst 300 index of top regional shares both reached their highest levels since Britain voted on June 23 to exit the European Union, with bank shares rallying, but the indexes trimmed gains after the Bank of England caught investors off guard by keeping interest rates unchanged.

Thursday's gains in U.S. and European stocks helped push MSCI's all-country world equity index to an eight-month high of 412.47. Safe-haven assets such as U.S. Treasuries, gold, and the Japanese yen fell in value on the greater risk appetite.

"The fact that JPMorgan’s earnings came out favorably bodes well for the entire banking sector," said Mark Heppenstall, chief investment officer of Penn Mutual Asset Management in Horsham, Pennsylvania. "If banks are healthy ... then that clearly has more positive implications for economic growth."

The MSCI world equity index was last up 2.51 points, or 0.61 percent, at 411.81.

The Dow Jones industrial average closed up 134.29 points, or 0.73 percent, at 18,506.41. The S&P 500 ended up 11.32 points, or 0.53 percent, at 2,163.75. The Nasdaq Composite ended up 28.33 points, or 0.57 percent, at 5,034.06.

Europe's broad FTSEurofirst 300 index closed 0.86 percent higher, at 1,337.69.

Oil rallied as short covering lifted prices, which were hammered on Wednesday by unusually weak U.S. demand for motor fuel.

Brent crude settled up $1.11, or 2.40 percent, at $47.37 per barrel. U.S. crude settled up 93 cents, or 2.08 percent, at $45.68 a barrel.

"It's always the case a day after a big rally or selloff for people to feel it was overdone," said Phil Flynn, an analyst with Chicago brokers Price Futures Group.

The dollar hit a nearly three-week high against the yen of 105.93 yen on the greater risk appetite, while sterling hit a two-week high of $1.3480 after the BoE decision.

Benchmark 10-year U.S. Treasury yields hit a nearly three-week high of 1.551 percent, partly on U.S. data showing rising inflation. Bond yields move inversely to prices.

Spot gold prices fell to a two-week low of $1,319.82 an ounce.

(Additional reporting by Marc Jones in London, Yashaswini Swamynathan in Bengaluru and Karen Brettell and Barani Krishnan in New York; Editing by James Dalgleish, Tom Brown and Nick Zieminski)