Neighbours raised the alarm after spotting the 25-year-old, named locally as Jamie Paterson, outside a house on Salters Road at 7am.
He was taken to Edinburgh Royal Infirmary but later died.
A Police Scotland spokesman said: “Officers were alerted to an address in Salters Road, Dalkeith, at around 7am on Saturday, August 27, after receiving a report of concern for a male occupant.
“Upon arrival officers discovered a 25-year-old male lying unconscious in the rear garden.
“He was taken to the Royal Infirmary of Edinburgh where he sadly passed away.
“His death is being treated as unexplained at this time.
“Anyone with information that can assist with our ongoing investigation is asked to contact Police Scotland on 101.”