Darren Machon, 39, of Maesteg, had denied burgling a house in Park Street, Bridgend, in February.
But a witness spotted his "distinctive" boxer shorts after she saw him bent over while rummaging through cupboards, a statement from South Wales Police said.
He was jailed for 34 months on Tuesday after a trial at Cardiff Crown Court.
Machon was arrested for the burglary while he was in police custody for a separate offence, the police statement said.
As he was getting changed in his cell, an officer noticed his underwear, which had pictures of hot dogs and doughnuts, matched those described by the witness of a burglary earlier that day.
Det Con Darren Bowen said: "The witness in this case and also the officer who recognised the underpants also deserve credit as it was their vigilance and attention to detail which no doubt ensured that Darren Machon was linked to the burglary.
"He is a prolific criminal who will spend a number of years behind bars where he belongs - no doubt he'll spend a few of those years thinking about how he should have put his lucky pants on that day."
Machon was also convicted of dangerous driving and disqualified from driving for 41 months.
A burglar has been jailed after his "novelty" underwear was held up in court and used as evidence against him.