Police Scotland said a 32-year-old man is being treated in hospital and that officers are not looking for anyone else in connection with the incident.
The bodies were discovered in Bonnyrigg, Midlothian, at about 8.30pm yesterday.
Officers went to the house in South Chesters Lane after a "family acquaintance" voiced concern.
Chief Inspector Colin Brown said: "A 32-year-old man is currently receiving treatment in Edinburgh Royal Infirmary and police are not looking for any other person in connection with this incident.
"The man is being treated as a patient, however there are police officers with him in hospital.
"This is a tragic set of circumstances and our thoughts are with the families who have been affected.
"We are keeping an open mind as to what occured within this property but I want to reassure members of the local community and neighbours that such incidents are relatively rare and a comprehensive investigation is under way.
"We are grateful to the support we are receiving from the neighbours while we carry out our inquiries."