The median sale price for a home in the nine-county region hit $519,000 in May -- a 29.8% increase from the same month a year earlier -- real estate firm DataQuick said Thursday. That was a nearly 2% increase from April.

Buyers purchased 8,541 new and existing houses and condos, down 4% from May 2012, but up 12.1% from April. More homes are typically sold in May than April.

Low interest rates, an improving economy and tight inventory have driven dramatic price increases in California and in many markets across the country. DataQuick said pent-up demand and investor activity also have helped push prices up.

“Among potential buyers there is clearly a sense that favorable factors are lined up right now in a way they may not be in a year, or three or five years,” DataQuick President John Walsh said in a statement.

Sales of distressed homes declined in May. Short sales and homes foreclosed upon in the last year accounted for 21% of homes resold in the Bay Area. That was the lowest level since December 2007.

All nine Bay Area counties saw double-digit year-over-year increases in the median sale price last month. Contra Costa County’s rise was the largest, climbing 39% from last year to $410,000. In San Francisco, the median jumped 24.1% to $870,000.

The median sale price is the point at which half of homes sold for more and half sold for less; it is influenced by the types of homes selling as well as a general rise or fall in values.

Much of the increases can be attributed to the lack of homes available for sale, which has caused traditional home buyers and investors to engage in bidding wars. In San Francisco, there were about 25% fewer homes for sale in May than a year earlier, but almost 15% more than April, according to Realtor.com.

As more owners — lured by rising prices — place their homes on the market and new home construction increases, the sharp price increases should ease, experts say.