A judge sentenced a Gary man to two years in prison Wednesday after admitting he opened fire at a couple outside a laundromat last spring.