In a letter to Rai's family, Gandhi expressed her condolence and said: "Ever since receiving the news of your brave husband's death, my thoughts and prayers have been with you and your family."
"I share your grief with all my heart - I know what it is to lose beloved husband to a terrorist attack and for children to be robbed of the love and guidance of their father at a young age," she said in her letter.
Rai, who died fighting the terrorists in Jammu and Kashmir, was cremated in New Delhi with the army, people and his family paying tributes.
Colonel M N Rai was accorded with Guard of Honour. He died fighting terrorists a day after he was awarded with a gallantry medal on the Republic Day.
His wife, two daughters and son were present along with Army chief General Dalbir Singh Suhag.