Two other Saudis were jailed for 33 and 27 years respectively, the official Saudi Press Agency (SPA) said.
In February 2006, suicide bombers with explosive-laden vehicles attempted to penetrate the oil-processing plant at Abqaiq, in Eastern Province, killing two security guards.
The pair of militants also died in the attack, which failed to breach the compound and was claimed by the Saudi branch of Al-Qaeda.
Saudi security forces later killed five men linked to the plot during an armed clash in the capital.
Signup to our newsletter and follow us on Facebook and Twitter!
The court in Riyadh convicted the men of various charges including "participation by agreement" with the Abqaiq attack, the SPA said.
"One of them had been responsible for Al-Qaeda's media activities inside the kingdom," it added.
They were also found guilty of offences including the possession of bombs, weapons and ammunition.
Authorities in 2011 established specialised tribunals to try Saudis and foreigners accused of belonging to Al-Qaeda or of involvement in deadly attacks in the kingdom from 2003 to 2007.
The latest convictions come as Saudi Arabia and its Gulf neighbours participate in US-led air strikes against Islamic State group militants in Syria, raising concerns about possible retaliation in the kingdom.