By Leslie Scism and Ben Otto

U.S. insurance giant Allstate Corp. agreed to acquire peer National General Holdings Corp. for about $4 billion in cash, expanding its reach in the personal property-liability business.

Allstate will add relationships more than 42,000 independent agents aross the U.S. in the acquisition. While many insurance companies have increasingly steered away from armies of agents as more consumers buy all types of products online, the deal reflects Allstate's view of a continued role for middlemen in selling policies to individuals.

The pact also highlights technological change that is coursing through the car- and home-insurance industry, including to speed up the buying process and make life easier for agents. Wall Street analysts said the relatively unknown National General, based in New York City and partially owned by the low-profile entrepreneurial Karfunkel family, has advanced technology.

The deal for National General is one of the biggest since the global coronavirus pandemic as economic uncertainty continues to complicate leadership decisions at companies across the world.

In an interview, Allstate Chief Executive Tom Wilson said that the pact had its origins early this year and was put on hold by the pandemic. But he said fresh scenario planning indicated that the possible financial returns "from moving forward outweighed the potential risk of the pandemic getting worse." He added: "Nobody knows for sure."

The downside risk includes a major recession that leaves yet-more people unemployed and unable to pay their car and home premiums, and would lead to steep drops in purchases of homes and cars, he said.

To date, "the pandemic has had modest impact on Allstate and the auto-insurance industry," he said.

In fact, car insurers benefited in one big way: Shelter-in-place rules kept millions of policyholders' vehicles parked in driveways, and accident rates plummeted. Allstate has returned more than $1 billion in premiums to its customers, part of an industrywide movement in which insurers slashed billions of dollars of premiums owed to them in April and May under tens of millions of policies, prodded partly by consumer activists.

More recently, traffic volume has picked up as many states have lifted shelter-at-home restrictions.

Mr. Wilson said the deal highlights that while some consumers don't want help from agents, "some people do want help, and we'll do whatever they want....Technology enables you to do that better, cheaper and faster."

Allstate said the acquisition would increase its market share in personal property-liability insurance by more than 1 percentage point to just over 10%. That brings it nearer to No. 3 Progressive.

Besides auto insurance, National General's product offerings include accident- and supplemental-health insurance policies and "lender placed insurance," which is coverage that banks and other lenders require borrowers to have in place to protect underlying collateral.

Under the deal, shareholders of National General will receive a total of $34.50 a share, an offer that comprises $32 a share from Allstate and expected closing dividends of $2.50 a share, the companies said. The total offer represents a 69% premium to the stock's last-traded price.

Allstate will fund the deal with $2.5 billion in cash resources at Allstate and National General and by issuing $1.5 billion in new Allstate senior debt.

Allstate investors reacted warily. Allstate shares were down 3.7% in midday trading, while National General shares were up 65%.

Many Allstate shareholders are wondering if they might be better off if the car insurer ramped up its stock-repurchase program rather than do the deal, some analysts said in notes to investors. Allstate is maintaining its stock-repurchase program, but "investors will focus on the fact that this capital could have been used to buy back shares," Wells Fargo Securities analyst Elyse Greenspan said.

Evercore ISI analyst David Motemaden said Allstate becomes a more-complicated story for investors as now "there is an integration and less dry powder for capital return."

Allstate said the deal would have no impact on its current roughly $3 billion share-repurchase program. Allstate's Mr. Wilson said the deal would be "accretive to adjusted net income earnings per share and return on equity beginning in the first year."

National General's gross premiums written were $5.6 billion in 2019, which generated $319 million in operating income, the companies said.

Allstate said it is acquiring an experienced management team in the deal. "We are excited about combining our team's expertise and commitment with Allstate to become a top-five personal-lines carrier for independent agents while offering a broader array of products," Barry Karfunkel, co-chairman and CEO of National General, said.

Billionaire tech mogul Michael Dell's private investment firm MSD Capital, which owns about 7.4% of National General's common shares outstanding, said it supports the deal.

National General's board has approved the transaction, which includes a breakup fee of $132.5 million. The companies said the deal is expected to close early next year, subject to regulatory approvals.

Write to Leslie Scism at leslie.scism@wsj.com and Ben Otto at ben.otto@wsj.com