BofA Merrill Lynch just raised its target for the S&P 500 — but not for a good reason

Closing Bell Exchange: Markets giving up down ticks for Lent

Bank of America Merrill Lynch raised its forecast for the S&P 500 — but it did so because it believes over-optimism is taking hold, and the years-long market rally will end soon.

The firm's year-end target for the index is now 2,450, up from 2,300 previously. That makes BofAML's estimate the third-highest among 16 strategists surveyed by CNBC in early February.

"We are updating our models to reflect the increasing likelihood that we are entering a typical end-of-bull-market rally, where fundamentals take a back seat to sentiment and technicals," Savita Subramanian, head of U.S. equity and quantitative strategy at Bank of America Merrill Lynch, said in a Wednesday note.

"The stock market has always seen outsized returns leading up to its eventual crash, and we think this time will be no exception," she said.

Investor optimism reached a 30-year high, while certain technical indicators on the market indicate to some strategists that stocks are likely setting up for further gains. The S&P 500 traded at fresh record highs Wednesday.

On a fair-value basis, Subramanian estimates the S&P should be at 2,230, more than 130 points below Tuesday's close of 2,363. She pointed out that historically, the last two years of a bull market in stocks returned a minimum of 30 percent.

Buffett: Stocks are safe in the long run and very unsafe for tomorrow

The current bull market is coming up on its eighth anniversary on March 9. A bull market is a period in which stocks trend higher, without ever falling 20 percent from a recent high.

U.S. stocks haven't fallen more than 10 percent from a recent high since early last year, when worries about China's economy, plunging oil prices and a potential U.S. recession rattled markets. Stocks only pulled back about 5 percent over two days last June following the surprise U.K. vote to leave the European Union.

In the months since then, improving economic reports and promises of growth-friendly policies from the Trump administration have helped U.S. stocks surge to record highs.

In late November, Subramanian raised BofAML's 2016 price target from 2,000 to 2,100, given the market had passed through the biggest shocks of the year.

The S&P 500 gained 9.5 percent last year to end at 2,238.83 and has climbed more than 7 percent since.