The number of homes listed for sale on Long Island plummeted last month, driving up prices as buyers competed for scarce listings, the Multiple Listing Service of Long Island reported Thursday.

The median home price in Nassau County was $475,000 in April, up 8 percent from a year earlier. In Suffolk County the median price rose 9 percent, year over year, to $340,000.

Inventory fell annually by almost 10 percent in Nassau, to 5,104, and by 17 percent in Suffolk, to 7,430.

The number of closed sales fell, year over year, by 9 percent in Nassau and increased by 0.6 percent in Suffolk.

Buyers are getting into bidding wars over the most desirable homes, and some repeatedly lose out because they refuse to raise their price enough, said Andy Yakubovsky, manager of Century 21 American Homes in Oceanside. “Usually by the third time, they say, ‘I see a pattern here, I need to go full or over asking price,’” he said.

But with inventory so tight, in some cases sellers accept a bid and start looking for their next home — only to realize there’s nothing acceptable in their price range, Yakubovsky said. Some of those contracted sales fall through, contributing to the decline in closed transactions, he said.

advertisement | advertise on newsday

Homeowners, he said, “are basically saying, ‘Never mind, I’m staying,’ ” he said.

In Suffolk, lower prices and real estate taxes are drawing buyers ranging from retirees downsizing from big homes in Nassau to professionals commuting to work in New York City, said Steve Abruzzo, an associate broker with Gateway to the Hamptons Real Estate in Center Moriches.

“As soon as something comes on the market, it sells within the first month,” he said.