Bakhtiyor Makhmudov and Zafarkhon Rakhmatov from Muslim-majority Tajikistan will serve their sentences in a “strict regime camp,” a court statement said.
Russia’s FSB security service arrested the duo in December 2017, accusing them of planning suicide bombings over the New Year and during a forthcoming presidential election campaign.
The pair pleaded guilty, the RIA Novosti news agency said.
Almost 2,900 Russian extremists, mainly from Muslim-majority republics in the south of the federation, have fought in Iraq and Syria, according the FSB.
Several thousand others from ex-Soviet Central Asian countries are also believed to have fought in conflicts there.
In 2017, Russia was hit by several terrorist attacks, the most serious of which left 15 dead and many injured in the metro of second city Saint Petersburg.