Brazil won the opening two sets and twice during the third set had a chance to win the gold.
On both occasions, however, Mikhaylov put away a spike to keep the Russians alive and they eventually won the third set.
Russian finally pulled out the win 19-25, 20-25, 29-27, 25-22, 15-9.
That prevented the Brazilians from sweeping the volleyball gold medals at these Olympics. The women's team from Brazil defeated the United States on Saturday for its second straight Olympic title.
The Brazilian men also lost in the 2008 finals to the United States.
Dmitriy Muserskiy had a game-high 31 points for Russia and Mikhaylov added 17.
Italy took the bronze medal with a 25-19, 23-25, 25-22, 25-21 victory over Bulgaria.