The victim suffered serious injuries - believed to be stab wounds - after he was attacked at a house in Auld Coal Grove, Bonnyrigg, at about 16:00 on Tuesday.
He was taken to the Royal Infirmary of Edinburgh, where he later died.
The arrested man is due to appear at Edinburgh Sheriff Court on Thursday.
A 36-year-old man has been charged with murder following the death of a 40-year-old man in Midlothian.