As BART’s ridership surged three years ago, along with the number of homeless people lingering inside its downtown San Francisco stations, the transit system doubled down on custodial work — and some of its janitors started cleaning up paywise.

One system service worker, BART’s title for janitors, made a little more than $271,000 in 2015, with $162,050 of that in overtime. A year later, two other BART janitors joined him in collecting more than $100,000 in overtime pay in a year.

Three years later — after the tale of the high-earning BART janitor became legend and the transit system, and the man himself, became an object of criticism — BART seems to be getting a handle on janitorial overtime, although a handful of its system service workers are still doing quite well.

Compensation data from 2017, obtained through a public records request, show that none of BART’s 138 janitors made more than $100,000 in overtime pay, although five of them made more than $100,000 in total pay compared with 50 in 2015 and 12 in 2016.

“There’s been a lot of attention paid to getting salaries in alignment,” said Robert Raburn, president of the BART Board of Directors. “We’re righting the ship and making sure we have reasonable workforce policies in place.”

The public fallout over the amount of money BART was paying its janitors helped drive the decision to reduce overtime, said Alicia Trost, an agency spokeswoman.

“The general manager made a clear directive to rein in the overtime numbers,” Trost said. “We offered less overtime to employees and hired more cleaners.”

The controversy surfaced in 2016 when Transparent California, a watchdog group, publicized system service worker Liang Zhao Zhang’s $271,000 pay in the previous year, calling it “outrageous and irresponsible.”

Zhang quickly gained international fame, or infamy, as news outlets, cable TV commentators, New York and London tabloids and websites blasted him and BART. KTVU reviewed surveillance video and reported that Zhang took overly long breaks behind closed doors in a room at Powell Street Station.

BART officials said then and now that Zhang legitimately earned his pay by working long and hard and completed the work expected of him. He managed to rack up so much overtime by accepting nearly every extra shift offered, either because seniority required that it be offered to him or because no one else wanted the additional hours.

In 2017, BART’s overtime spending systemwide rose by $2.2 million — but the department charged with keeping stations clean managed to cut its overtime by nearly $1 million, records show.

The drop was accomplished by placing a freeze on overtime for part of the year and by hiring 21 additional cleaners to reduce the need for overtime. The freeze was lifted partway through the year when some of the stations needed more attention from cleaners.

The result was that Zhang still worked a lot of overtime in 2017, enough to boost his salary of $63,684 to $138,243. Two other janitors made more: Gapo Chan made $173,037, including $78,998 in overtime, and Yiu Kai Fo was paid $154,678, including $79,500 in overtime.

“Overtime costs are still up there,” Trost acknowledged, “but they are significantly lower than last year.”

BART’s goal is to place a lid on overtime while ensuring clean stations by keeping the janitorial staff up to 150, the maximum authorized by the Board of Directors.

Transit system officials are also reorganizing the way BART handles station cleaning. It is assigning a crew of janitors dedicated to a single station rather than shuffling them among two or three. Standardized cleaning plans will be established, and customer satisfaction surveys will be conducted to help determine where attention is needed.

Meanwhile, Zhang has never spoken or written to the media about the overtime controversy. Cecille Isidro, a spokeswoman for his union, Service Employees International Local 1021, said he still doesn’t want to speak about the situation. She said he received death threats at his home in 2016.

“He’s really upset about the whole thing,” she said. “He doesn’t want to talk about it to anybody — even his union reps.”

Other departments overshadowed Zhang’s department in 2017, records show. The one in charge of operating trains reported $11.18 million of overtime in 2017 and the Police Department spent $6.15 million.

Overtime is necessary for rail operations, Trost said, because BART has to keep trains running even if someone calls in sick. Special events like parades or rallies, sometimes scheduled with short notice, also require overtime to fill extra shifts.

BART police are forced to work mandatory overtime shifts regularly because the department has 31 vacant officer positions and can’t leave shifts or assignments uncovered.

Other departments with large overtime budgets include station operations, at $5.66 million; train maintenance shops, $5.31 million; track, grounds and structures maintenance, $3.68 million; train control, $2.34 million; traction power, $2.3 million, and the revenue vehicle trouble desk, which dispatches technicians to failed trains and cleaners to trains in need of urgent cleaning. System services had $1.5 million in overtime.

In addition to monitoring overtime, BART is planning a study in the transportation department, which operates trains, in the coming year, Trost said. Other departments will follow.

Keeping the trains running, and overtime in check, can be a balancing act. Director Debora Allen said it can be cost-effective to pay a certain amount of overtime rather than hiring workers who are paid benefits as well as wages.

“Sure, we’re paying time and a half,” she said, “but we’re not paying benefits, and benefits at BART are a big cost.”

Overtime might seem to represent an unnecessary expense or a failure to properly plan or budget, but Trost said it’s not going to be eliminated.

“It is not economical, and it is not possible,” she said. “Overtime serves a useful function in being able to quickly staff up when needed and then pull back as circumstances change.”

Michael Cabanatuan is a San Francisco Chronicle staff writer. Email: mcabanatuan@sfchronicle.com Twitter: @ctuan