KB Home , the fifth-largest U.S. homebuilder, reported a wider-than-expected quarterly loss on Friday, as pressure on home prices offset the company's first rise in home deliveries in three-and-a-half years.

KB's loss narrowed to $30.7 million, or 40 cents a diluted share, in the second quarter, down from a net loss of $78.4 million, or $1.03 per diluted share, last year.

Revenue fell nearly 3 percent to $374.1 million as average selling prices dipped 4 percent to $207,900, offsetting a 1 percent rise in deliveries -- the first such rise in 14 quarters.

Analysts, on average, expected the company to report a loss excluding items of about 30 cents a share and a net loss of 28 cents a share on sales of $373.02 million, according to Thomson Reuters I/B/E/S.

(Reporting by James B. Kelleher; Editing by Derek Caney)