The present invention relates to a compound represented by the formula:whereinAr is an optionally substituted ringA is a spacer having a main chain of 1 to 4 atomsB is a bond, a C1-10 alkylene group or an oxygen atomR3 and R5 are each independently a hydrogen atom or a substituentR4 is an optionally substituted cyclic group or an optionally substituted C1-10 alkyl group andR1 and R2 are each independently a hydrogen atom or a substituent, orR1 and R2 or R1 and B are bonded to form an optionally substituted nitrogen-containing heterocycle, orR1 and Ar are bonded to form an optionally substituted nitrogen-containing fused heterocycle, or a salt thereof. The thienopyrimidone compound of the present invention has a superior melanin-concentrating hormone receptor antagonistic action, and is useful as an agent for the prophylaxis or treatment of obesity and the like.