Belgacem Nawar, 44, was sentenced on Wednesday by a court in the Tunisian capital, Tunis.
He is the uncle of Nizar Nawar, who died after ramming a gas-laden lorry into an ancient synagogue on the resort island of Djerba in April 2002.
The attack killed 14 German tourists, five Tunisians and two French citizens.
Nawar, a welder from the island, was charged with complicity in murder and making explosive devices. He was said to have helped his nephew put a gas tank on the lorry.
However, Nawar said he had only helped his nephew buy the lorry and had no idea what he planned to use it for.
The attack on Djerba was the first claimed by al-Qaeda in an Arab country following the September 11 attacks in the US.
Nawar's defence lawyers walked out of the court before the verdict to protest what they alleged was an unfair legal process, including the judge's refusal to grant more time to prepare Nawar's defence.
They said they planned to appeal his sentence.