Comcast Corp. has agreed to buy Time Warner Cable Inc. for $45.2 billion in stock, or $158.82 per share, two people familiar with the matter said late Wednesday.

The deal will combine the nation’s top two cable TV companies and make Comcast, which also owns NBCUniversal, a dominant force in both creating and delivering entertainment to U.S. homes.

The deal was approved by the boards of both companies and, pending regulatory approval, is expected to close by the end of the year, the people said.

The people spoke on condition of anonymity because the deal had not been announced formally. An announcement is set for Thursday morning, they said.

The price is about 17 percent above Time Warner Cable shares’ Wednesday closing price of $135.31 and trumps a proposal by Charter Communications Inc. to buy Time Warner for about $132.50 per share, or $38 billion in cash and stock. (Associated Press)