Companies buying massive amounts of their own shares may be a key reason why certain sectors are doing better than others in the nine-year bull market for stocks.

On Monday, Yardeni Research said technology companies bought back $1 trillion worth of their shares since the beginning of the bull market in the first quarter of 2009, followed by the consumer discretionary sector at $632 billion.

Apple represented about 20 percent of the technology sector's total with $199.6 billion of share repurchases in the time period, according to its website.

The firm noted the two sectors were the top performing areas in the stock market. Consumer discretionary shares rose 592 percent since March 2009, while the technology sector rallied 511 percent.

The technology industry also led buybacks in the first quarter this year at $63.4 billion, leading to the second-best sector performance year to date at a 10 percent return, according to Yardeni.

“The buybacks help to explain the outperformance of the S&P 500 Information Technology sector so far this year,” strategist Ed Yardeni said in the note to clients.

Market research firm TrimTabs said earlier this week share buyback intentions reached a record high in the second quarter. Corporations announced $433.6 billion in share repurchases during the period, nearly doubling the previous record of $242.1 billion in the first quarter.

In addition to the buyback surge, companies issued a record $111.6 billion in dividends during the second quarter, bringing the 2018 total to $220.8 billion, a 7.8 percent increase over the same period a year ago, according to Howard Silverblatt, senior index analyst at S&P Dow Jones indices.

— CNBC's Jeff Cox contributed to this report.