Both the number and price of homes sold in the North Bay increased in July, driven by Bay Area-wide trends that include increased mid- and up-market buying activity, according to a report today from San Diego-based real estate tracking firm DataQuick.

The increase is part of a 13-month upward trend across the Bay Area, with the median price paid for a home rising to its highest level since August 2008.

In Sonoma County, 665 homes were sold, a 38.8 percent increase since July of last year. The median price increased 4.4 percent, to $320,000.

In Marin, 338 homes were sold, a 45.7 percent increase over the same month in 2011. The median price was $660,000, a 3.9 percent increase.

Napa County saw a 28.6 percent increase in the number of homes sold, at 135. The median price rose 32.6 percent, to $372,500.

A total of 610 homes were sold in Solano County, a 1 percent increase. The median price increased 1.3 percent versus July 2011, to $188,000.

Across the Bay Area, 8,461 homes were sold -- a 22.9 percent increase since July 2011. The median price was $421,000, up 12.6 percent and the highest since a median of $447,000 was reported nearly four years ago.

“The market has really been lopsided the past couple of years, tilted toward low-end bargain chasing. Now it’s rebalancing, slowly, with increased activity in mid and move-up markets. But mortgage availability remains one of the big challenges in the Bay Area,” said John Walsh, DataQuick president, in a release.

DataQuick noted that roughly half of the year-over-year gain in median price was attributable to an increase in mid-to-upper priced homes. Price levels for the lowest-cost third of Bay Area homes rose 9.6 percent, with a 7.8 percent gain in the middle and 1.2 percent in the top third of the market.

Distressed property sales, including foreclosure resales and short sales, made up 34.6 percent of the resale market last month, down from 36.6 percent in June and 44.5 percent at the same time in 2011.

Homes sold that went through foreclosure in the past 12 months composed 15.7 percent of the resales in July, the lowest since 14 percent in December 2007. The rate was 25.9 percent one year ago, and peaked at 52 percent in February 2009.

Adjustable-rate mortgages accounted for 13.3 percent of the Bay Area’s home purchase loans, down from 14.4 percent in July of last year. The most active lenders to Bay Area home buyers last month were Wells Fargo, 17.7 percent, RPM Mortgage, 4.2 percent and Bank of America, with 3.5 percent. The top 10 lenders composed 40.7 percent of lending, down from 45 percent one year ago.

Absentee buyers purchased 22.6 percent of homes sold in the Bay Area last month, up from 20.5 percent one year ago.

DataQuick noted stability in low payment sizes for current mortgages and a decline in multiple mortgage financing. The typical monthly payment of $1,522 was 59.8 percent below the inflation-adjusted payment when the current real estate cycle peaked in July 2007.