Moscow is about 580 miles from Riga.
The only direct trains operate on a (very) slow, overnight service. The 1620 service is the fastest, with a journey time of 16 hours 21 minutes. It arrives in Moscow at 0941. The other overnight train leaves Riga at 1800. Its journey time is 17 hours 16 minutes and it arrives in Moscow at 1216.
There are other train services but these involve changes and take between 24 and 25 hours.
All European rail timetables are available, in English, on the German Railways website, here:
http://reiseauskunft.bahn.de/bin/query.exe/en
Chris