Police had initially blamed Pakistan-based Islamist extremists for the 2007 attack on the revered 12th-century Sufi shrine at Ajmer in the western state of Rajasthan, which killed three people and injured 15.
But earlier this month a special court in Rajasthan found Devendra Gupta and Bhavesh Patel guilty, the first time in living memory that Hindu radicals have been convicted for such a crime.
A third man who was shot dead in the months after the attack and tried posthumously was also convicted.
All three were convicted on charges related to explosives and conspiracy to commit unlawful acts over the blast, which came just before the Muslim festival of Eid.
Magistrate Dinesh Kumar Gupta pronounced sentence on Wednesday.
Special public prosecutor Ashwini Sharma said their motive was to create communal disharmony.
“Their motive was to hurt religious sentiments of Muslims during the month of Ramzan (Ramadan) by the bomb blast,” Sharma said.
Gupta and Patel's lawyer J.S. Rana told journalists they would appeal the verdict in a higher court.