SAN JOSE — Advocates for the homeless saw gains on two fronts on Tuesday, as officials in Santa Clara County and San Jose approved plans to significantly bolster available shelter space and services for the estimated 6,500 Silicon Valley residents who don”t have a permanent place to lay their heads at night.

The motions at City Hall and the Board of Supervisors chamber were the latest examples of city and county cooperation toward solving a problem that officials say costs local government $520 million annually in services such as emergency room trips, jail stays and mental health care.

“The evolution of this has been fascinating,” said Jennifer Loving of Destination: Home, a group that works with government and nonprofit agencies to reduce homelessness.

County supervisors approved more than $13 million to buy and renovate hotels and motels that could be used to provide temporary shelter or long-term housing. The board approved an additional $3.8 million for ongoing programs, including expanding existing temporary and permanent housing services, as well as drop-in centers with access to food, showers and restrooms. That includes a fivefold increase in the number of year-round emergency shelter beds, adding 585 to the existing stock of 130. Supervisor Cindy Chavez said that”s critical with predictions of a wet winter.

“We”re in a race against El Nio,” she said. “We need to take immediate action to reduce human misery from the heavy rains that we expect.”

Also in the mix are smaller amounts for more experimental programs, such as setting aside parking areas for folks who live out of a vehicle, creating a prototype of a small “microhouse on wheels,” and looking into legal campground sites — something supporters say would bring the most bang for the buck.

The latest round of funding brings the county”s spending on programs for the homeless to about $100 million a year.

The county”s efforts were underscored by its largest city committing millions of dollars to develop a 135-unit apartment complex for permanent supportive housing — the city”s first housing project totally dedicated to the homeless.

San Jose”s interim housing director Jacky Morales-Ferrand said it”s the first time he”s seen the city and county aligned in their vision to reduce homelessness.

“Having the county, housing authority and city all working together is essential because we need to leverage our resources,” Morales-Ferrand said. “By working together we can come up with more innovative solutions and we”re leveraging off each other.”

Loving of Destination: Home agreed that the collaboration was encouraging.

“Five years ago, San Jose would do something and Santa Clara County would do something but nothing was coordinated,” she said.

The city on Tuesday raised a loan amount from $8 million to more than $14 million speed up construction of the Second Street Studio Apartments at 1140 S. Second St. The facility will house individuals and couples inside four stories of 450-square foot studio apartments and six one-bedroom units, with space for businesses and homeless services on the ground floor.

Chris Richardson, regional director of Downtown Streets Team, a nonprofit working to end homelessness, said the city”s commitment to housing the homeless has helped decrease the number of people living on the streets in the past two years.

Santa Clara County saw a 14 percent reduction, going from 7,631 homeless individuals in 2013 to 6,556 this year. San Jose”s homeless population went from 4,770 in 2013 to 4,063 in 2015.

“We know, simply put, the way to end homelessness is homes and supportive housing,” Richardson said. “And we know we have a shortage of affordable housing at every single level and the city and county are stepping up to make it a priority.”

Loving said that residents are noticing that homelessness is not a problem that can be ignored.

“It”s less of a charity argument now,” Loving said, “and more talk about community benefits.”

Contact Eric Kurhi at 408-920-5852. Follow him at Twitter.com/erickurhi. Contact Ramona Giwargis at 408-975-9346. Follow her at Twitter.com/RamonaGiwargis.