Five years ago, 80 clerks and salespeople at Pilot Travel Centers LLC spent a combined 3,200 hours a week tracking and paying for orders for thousands of goods, ranging from candy bars to diesel fuel.

They typed the orders into an accounts-payable database, and printed out thousands of checks to pay suppliers. After slipping them into envelopes and adding postage, they put the checks in the mail.

“It was just awful,” said David Clothier, treasurer of the Knoxville, Tenn., company, which operates more than 500 Pilot Flying J truck stops nationwide. “There were humans everywhere.”

Today, a computer “robot”—basically software—automates these tasks. Suppliers send their invoices to Pilot Travel electronically. Its software sends out payments and records every transaction. As a result, the company needs just 10 clerks working a weekly total of 400 hours to pay suppliers.

Robots are taking over corporate finance departments, performing work that often required whole teams of people. Big companies such as Pilot Travel, New York-based Verizon Communications Inc. and GameStop Corp., of Grapevine, Texas, are among those using software to automate many corporate bookkeeping and accounting tasks.

Businesses use these programs to save time and staffing costs. Since 2004, the median number of full-time employees in the finance department at big companies has declined 40% to about 71 people for every $1 billion of revenue, down from 119, according to Hackett Group, a consulting firm.

The telecom giant Verizon has reduced its finance-department costs by 21% over the past three years, partially through job cuts. It closed more than half of its 200 back-office locations across the country, built a new hub for finance operations in Lake Mary, Fla., and renovated an existing one in Tulsa, Okla. “The automation is a big factor” in the savings, said Fran Shammo, Verizon’s CFO.

Software has helped Verizon, which had $127.1 billion in 2014 revenue, cut the manual entries its workers punch into Excel spreadsheets annually by a quarter—to 10,500 from 14,000. It aims to cut another 1,400 manual entries by the end of this year for an overall reduction of 35%.

Automation is threatening to replace swaths of white-collar workers, much as mechanical robots have displaced blue-collar workers on assembly lines. Among those in jeopardy: accounts-payable clerks; inventory-control analysts, who record and audit what is in stock and estimate inventory needs; and accounts-receivable clerks, who send invoices to customers, track payments, and forecast customer default rates.

Oracle Corp. and SAP SE, among others, sell software to companies that can automate, transmit and analyze information from different divisions. Airline-service crews using SAP’s software can scan the number of paper cups they bring into an airplane, and a system will ensure those items are correctly reflected on the invoice, said Henner Schliebs, a vice president at the German company. There would be no need for the airline’s accounts payable team to key the information into a computer.

Reducing back-office costs is a longtime obsession among corporate bean counters. Executives are more conscious of operating expenses, particularly since the financial crisis, said Michael Armstrong a principal at Deloitte Consulting LLP. “Companies as a whole are coming under a far greater degree of scrutiny,” he said.

Big companies employ 44% fewer full-time information-technology workers and 20% fewer human-resources workers than they did a decade ago, according to Hackett, at least in part because automation has cut the number of employees needed in those department too.

U.S. companies have long outsourced repetitive and manually intensive operations, often to countries with low-cost workforces. Now, even some outsourcing companies are using robots to handle finance tasks.

GameStop Corp. contracts with Ecova Inc. to pay and audit the telecommunications and energy bills for its 4,400 U.S. videogame stores. Ecova, based in Spokane, Wash., uses robots to pay the bills automatically, and its consultants analyze the data to find ways for GameStop to reduce spending.

GameStop has cut between 15 and 20 jobs in its accounts-payable, inventory-control and sales-auditing departments, said Robert Lloyd, its CFO. The retailer, which has sales of $9.3 billion a year, employs 18,000 people, including 120 in its finance back office.

Information-services company Wolters Kluwer NV uses Oracle’s Hyperion software to help close its books at the end of each quarter. The task, which used to take almost 10 days, now takes half the time.

With fewer workers needed to collect financial information, Wolters Kluwer is hiring more analysts to help sift its data on profits, revenue and cash flow, among other things, to help in planning and forecasting. Kevin Entricken, Wolters Kluwer’s CFO, said competition among companies for data analysts is making those workers scarcer and more expensive. “It’s harder to find people,” he said.

The Netherlands-based company is paying a higher average salary for each person in the finance department, even though head count has remained relatively stable, Mr. Entricken said. He declined to provide specific figures.

Accounting schools like those at Brigham Young University, in Provo, Utah, and the University of Denver, now provide training on SAP, Oracle and Microsoft Corp. systems in addition to training in bookkeeping.

In the short term, automation does reduce the number of available jobs, said Mihir Shukla, chief executive of Automation Anywhere Inc., of San Jose, Calif., which creates software for companies that use automation in their front and back offices. But, in the long run, software can help businesses operate more effectively. “If you think like a human, there are only certain things you can do. When you think like a robot, many things are possible.”

At Pilot Travel, the finance department’s head count is roughly 200 people, the same as five years ago. But the number of stores the company owns has jumped in the meantime to roughly 500 from 300.

“Our motto is: leverage computers, not humans,” said Mr. Clothier, the treasurer, referring to the company focus on automating many white-collar jobs.

Write to Vipal Monga at vipal.monga@wsj.com