Shane Richards and Carl Riddiough, both 30, were caught as part of an investigation into distraction burglaries in North Yorkshire in 2016.
Police were able to link the men's DNA to the caps found in a car.
Richards and Riddiough, both from Doncaster, admitted burglary at Teesside Crown Court and were each jailed for four and a half years.
Burglary victims, many who were elderly, reported two men knocking on their door claiming their ball had been kicked into the back garden.
When the homeowners took one of them to get the ball, the other would search the house and steal property.
The men were said to have been wearing flat caps and a witness who saw two men in a car contacted police.
The car was later found with the two caps inside both containing Richards and Riddiough's DNA.
Glass experts also analysed the caps and found samples of glass from one of the burglary scenes in both of them.