Comcast said Thursday it had agreed to buy Time Warner Cable for $45 billion in a deal that would combine the two biggest cable companies in the United States.

If the deal is approved, the combined group will be the country's dominant provider of television channels and Internet connections, reaching roughly one in three American homes.

Analysts say the consolidation could help Comcast to compete with satellite providers like DirecTV, wireless phone companies like AT&T (T) and new streaming services like Netflix (NFLX).

"This isn't about TV anymore -- it's about controlling a fatter, more intelligent pipe for multiple services that emanate from it," including broadband Internet, phone and home security monitoring, said Tim Hanlon, the founder of the Vertere Group, an investment advisory firm that focuses on media and technology.

Time Warner Cable (TWC) owners will be offered 2.875 Comcast (CMCSA) shares for each share they own, valuing Time Warner Cable at about $158.82 per share.

The two companies expect the merger to take effect by the end of the year, but regulators are likely to take a close look at the potential impact on consumers.

To address those concerns, Comcast said it was prepared to divest about 3 million subscribers. But it would still have about 30 million subscribers.

Map: Is this your new cable guy? See our map

The proposed deal ends months of jockeying for control of Time Warner Cable, the second biggest U.S. supplier of cable television with about 11 million subscribers.

Smaller rival Charter (CHTR) wanted to buy Time Warner Cable, indicating last month it was ready to pay about $130 per share.

Time Warner Cable called that price "grossly inadequate" and countered with a suggestion of $160 per share, very close to Comcast's offer.

But Comcast had cast a shadow over the negotiations, and had reportedly held talks with Charter about how to divvy up Time Warner Cable's territories.

Now, by swallowing Time Warner Cable on its own, Comcast will gain even more leverage over the country's marketplace for television, broadband Internet and phone services. Comcast has about 23 million television subscribers.

With millions more subscribers, Comcast will add muscle in its negotiations with cable channel owners like The Walt Disney Company (DIS) and Time Warner (TWC), the parent company of this website. (Time Warner Cable was spun off from Time Warner in 2009 and no longer has any connection to the owner of CNN, HBO and Warner Bros.)

Related: Weather Channel's cable fight is the tip of the iceberg

On a call with reporters on Thursday, Comcast executives projected $1.5 billion in operating efficiencies as a result of the deal, mainly through what they called "programming synergies."

James McQuivey, a media analyst for Forrester Research, said the deal signals Comcast's intention to be a tech giant -- not just a cable company.

McQuivey predicted that Comcast would eventually sell a bundle of cable channels via the Internet to households that can't currently subscribe to the company's products. Verizon and AT&T, the country's top two wireless companies, are also believed to be preparing similar "over the top" TV services.

"To really compete on equal footing with Apple and Amazon, Comcast has to figure out what it can offer the world, not just the U.S. All of that starts today."

Although cable providers in general have poor reputations, Comcast has received some high marks for its next-generation software and set-top boxes.

Time Warner Cable, on the other hand, had what the American Customer Satisfaction Index called an "industry low" score last spring. It has shed television subscribers in recent months for a number of reasons, including a protracted blackout of CBS and Showtime in several million homes. Comcast could theoretically improve Time Warner Cable's performance by bringing in its own software.

Related: Customers say deal is evil

But even before the official announcement of the deal, questions arose about whether Comcast will be allowed to expand its cable footprint so substantially.

Regulators used to enforce a rule that prohibited a single cable company from controlling more than 30% of the market. But Comcast led a challenge to that rule in the mid-2000s, and in 2009 a federal appeals court threw out the 30% cap.

Still, the proposed combination will surely be scrutinized by the government.

William Baer, who heads the Justice Department's antitrust division, recently told the New York Times that the department would closely scrutinize mergers in the wireless and cable industries. He said he was wary that consumers could benefit from certain combinations.

Gina Talamona, a Justice spokeswoman, declined to comment on Thursday.

The two companies are likely to point out that they don't directly compete -- Comcast has its own markets, like Philadelphia and Washington, D.C., and Time Warner Cable has its own, like New York and North Carolina. The lack of overlap may temper antitrust concerns.

Analysts also point out that Comcast is remarkably well connected in Washington. In fact, its chief lobbyist, David Cohen, was a guest at the White House state dinner for the French president on Tuesday night.

Comcast persuaded government agencies to approve its $30 billion bid for NBCUniversal in 2011. At that time it agreed to a number of conditions that were designed to prevent anticompetitive behavior. It could be compelled to do the same in this case.

On Wednesday night, some of the public interest groups that opposed the NBCUniversal deal, like Free Press, signaled immediate opposition to the consolidation involving Time Warner Cable. "Stopping this kind of deal is exactly why we have antitrust laws," Free Press said in a statement.

--CNN's Evan Perez contributed reporting to this article.

Clarification: An earlier version of this story had a chart showing that DirecTV has 31 million subscribers. That is its global subscriber number. The company has 20.2 million subscribers in the U.S.