Additional District and Sessions Judge Himashu Bhatnagar also imposed a fine of Rs 21,20,000 on each of the seven accused -- Muzammil, Mujassim, Furkan, Nadeem, Janangir, Afzal and Ikbal -- for killing Gaurav and Sachin on August 27, 2013 and rioting.
The court said that 80 per cent of the fine will go to the family of the two men who were killed.
This is the first case out of total 57 in which the seven men were found guilty, district prosecution counsel Rajiv Sharma said.
The court had convicted the accused on Wednesday.
According to the First Information Report, the two youths of Kawal village under Jansath police station area were battered to death by three of the five men.
The two other accused, Afzal and Iqbal, however, were later summoned by the court under provisions of section 319 of the Criminal Procedure Code when the evidence of their complicity in the killings emerged during the trial.
The court convicted the seven after examining 10 prosecution witnesses and six in their defence.
As per official figures, given by prosecution counsel Sharma, over 6,000 cases were lodged following the 2013 riots and 1,480 accused were arrested for their alleged roles in the riots, in which over 60 people were killed.
A special investigation team, which probed the cases, have filed charge sheets in 175 cases. Fifty-six of them involving 430 accused resulted in acquittal. The state government has withdrawn some cases.