Another man, aged 64, was rescued from the property and taken to hospital suffering from smoke inhalation.
The alarm was raised minutes before 4am by a police officer who noticed smoke issuing from the second floor window of a flat.
A spokeswoman for Lothian and Borders Fire and Rescue Service said:
“We were called to a report of smoke coming from a second floor flat on Restalrig Road at 3:54 am.
“Tragically a 37 year old man who was removed from the property was pronounced dead. A man aged 64 was taken to Edinburgh Royal Infirmary suffering from smoke inhalation.
“There were 27 firefighters at the scene, six firefighters in breathing apparatus used a high-pressure hose reel to extinguish the blaze. An investigation into the cause of the fire is now underway.”