Expedia Inc. (Nasdaq: EXPE) agreed to acquire HomeAway Inc. (Nasdaq: AWAY) for about $3.9 billion in cash and stock, giving the vacation- rental company some muscle as it tries to fend off competition from apartment-sharing startup Airbnb Inc.

The middle market has hosted a handful of travel transactions, including TA Associates' investment in Plusgrade, a revenue service for the travel industry, and Sabre Corp.'s (Nasdaq: SABR) acquisition of Abacus International for $411 million. Chicago private equity firm Thoma Bravo won Mergers & Acquisitions M&A Mid-Market Deal of the Year Award for its purchase of TravelClick for $930 million in 2014.

The travel website is paying $38.31 a share, the companies said in a statement after the close of New York trading on Wednesday. That’s 20 percent above Austin, Texas-based HomeAway’s price at the close. The shares rose as high as $39.54 in extended trading. Expedia’s stock rose as much as 6.4 percent.

Airbnb and other startups are changing the dynamics of the travel market by adding new capacity that competes with lodging operators and isn’t directly searchable by travel websites such as Expedia. That’s motivated them to respond by offering their own services that are based on people renting out their rooms and homes.

"It’s clearly a product that’s important for a certain group of people, so we will look to build out our rental product over time." Expedia Chief Executive Officer Dara Khosrowshahi told analysts in a conference call last week, during the company’s most recent quarterly earnings report. "Incrementally, it will become a more important part of our mix next year and going into the following years."

Expedia has had a partnership with HomeAway for two years, Khosrowshahi said in Wednesday’s statement. A year ago, the Bellevue, Washington-based company struck a deal to list 115,000 HomeAway vacation listings on its travel search engine. 

Bringing HomeAway into Expedia’s portfolio of brands “is a logical next step,” Khosrowshahi said.

HomeAway, founded in 2005 and trading publicly since 2011, allows users to arrange vacation rentals at 1.2 million properties around the world. Its sales rose 12 percent to $130.7 million in the third quarter, while net income doubled to $10.4 million, the company reported Wednesday.

In recent years the company has made acquisitions that have amped up its competition with Airbnb. HomeAway sued San Francisco last year to overturn a law legalizing short-term rentals that, it said, favored Airbnb and discriminated against other tourist rental businesses.