Dan Page

Law firms have some new competition these days: their own clients.

Instead of calling an outside lawyer to work on midlevel deals or contracts, many companies now handle that work in-house with growing teams of staff attorneys who don't bill by the hour.

This year corporations are shifting an estimated $1.1 billion that they used to spend on outside lawyers to their own internal legal budgets, according to a new data analysis. That migration cements a trend that took off during the recession, when general counsels were under pressure to rein in costs, and spiked in 2012, when companies redirected $5.8 billion in legal spending in-house.

About 58% of larger companies are sending more legal work to their own law departments this year, compared with 50% in 2013, according to the analysis by BTI Consulting Group Inc.

It is cheaper, some general counsels say—and often more efficient.

Many law firms are struggling to boost revenue and profits amid relatively slack demand for legal services. Some big law firms, which tend to offer more specialized services that are harder to replicate in-house, say they aren't feeling the pinch just yet. But others have had to make adjustments.

At McGuire, Wood & Bissette PA, a small firm in Asheville, N.C., junior attorneys once learned the ropes by handling routine real-estate transactions and contractual work. Now banks and corporate clients are assigning those tasks to their own internal lawyers and even to paralegals, limiting training opportunities for law firm associates and crimping revenue.

"There is less money to pay everybody," said partner Thomas Grella, who chaired the firm for a dozen years. The firm still handles more complex matters, he said, but "it's harder to find work for our younger lawyers."

That is one reason the firm stopped hiring recent law graduates and instead recruits more seasoned attorneys.

Companies and financial institutions will spend more than $101 billion on legal services in the U.S. this year, according to BTI's analysis, which is based on interviews with more than 300 corporate counsels. But law firms' grasp on their share is slipping. Corporate counsel spent an estimated $40.9 billion on their internal lawyers this year, a 22% increase since 2011.

Clients are hiring contract lawyers to do some work on an as-needed basis, or bringing in alternative service companies that promise to deliver better value on tasks such as document review, which law firms traditionally assigned to junior attorneys who might bill $200 an hour or more.

Corporate law departments also are tackling increasingly complex matters that were once the province of major law firms. Some are hiring seasoned attorneys with pedigrees from big law firms to come work inside companies, where they advise on everything from mergers and acquisitions to advertising rules and antitrust matters.

At United Technologies Corp. , nearly all work on small transactions—acquisitions, divestitures and commercial contracts—is now done internally, according to Steven Greenspan, vice president and chief litigation counsel for the conglomerate, which makes elevators, air-conditioning systems, jet engines and aviation components.

The company has three lawyers on staff devoted solely to advising different business units on environmental issues, for example, reducing the amount of such work it once sent to outside counsel. Most of its attorneys come from major law firms, according to Mr. Greenspan. "We are much more comfortable relying on our in-house lawyers. …They know our businesses better," he said.

More companies are embracing the trend. A survey of more than 1,200 chief legal officers found that 63% of respondents are now "in-sourcing" legal work that they used to send out to law firms or other service providers, according to a report released earlier this year by the Association of Corporate Counsel, an industry group.

In a separate poll, 29% of chief legal officers surveyed in late 2013 said they expected to decrease their overall use of outside counsel over the next 12 months, according to legal consulting firm Altman Weil Inc.

Many of the largest law firms have pivoted away from so-called commodity practices in recent years to concentrate on more specialized areas: white-collar defense work and government investigations, for example, or sophisticated, cross-border transactions and global regulatory issues. Such expertise is harder to duplicate in-house, and typically fetches higher prices.

In addition, many law-firm clients are middle-market companies with billions of dollars in revenue but little interest in expanding their own legal departments, said Peter Kalis, chairman and global managing partner of K&L Gates LLP, which has more than 2,000 lawyers world-wide.

But the dynamic is changing.

Thomas Sabatino, the general counsel for drugstore chain Walgreen Co., said corporate legal departments historically acted more like a switchboard for legal work, sending some to their own lawyers but handing most matters off to outside law firms.

In April 2013 the company overhauled its legal strategy. Staff attorneys sit in on meeting and strategy sessions, and serve as "quarterbacks" directing big litigation and transactions that involve outside law firms. Other work is now done entirely by the company's own attorneys, like buying up individual pharmacies and smaller chains.

"We did almost 100 of those last year," Mr. Sabatino said.

Write to Jennifer Smith at jennifer.smith@wsj.com