Hairdresser Ashley Gillard, 31, was discovered after the blaze in the third-floor property in Wolverton, Milton Keynes on 8 June.
Thomas White, 26, pleaded guilty to manslaughter by gross negligence.
Luton Crown Court heard White "flew into a rage", before returning to the flat several days later in an attempt to destroy any evidence of the killing.
White, of Bibury Close in Wellingborough, was originally charged with murder but prosecutors have accepted his plea to the lesser charge.
The court heard the pair had been taking illegal drugs, including GHB, and Mr Gillard had probably died on 5 June.
A post-mortem examination could not identify a definitive cause of death, but it confirmed Mr Gillard was dead before the fire started.
Graham Smith, prosecuting counsel, said the killing happened after Mr Gillard told White he had HIV.
"The defendant was furious and got into a rage and turned the flat upside down trying to find medications that would confirm what he had been told," said Mr Smith.
"He was later to tell his brother that he knew his friend needed medical attention but he did not help him, and put a duvet over him to shut him up.
"He said at that moment he hated him and wished him gone."
In the days between the killing and the fire, the prosecution said White had stolen cars and a forklift truck and was filmed by CCTV cameras buying petrol to start the fire.
The riverside flat in Trevithick Court where Mr Gillard's body was found had had its door barricaded.
White also pleaded guilty to 10 other charges including arson being reckless as to whether life would be endangered, theft, fraud and possession of Class B and C drugs.
He will be sentenced at a later date.
A man has admitted killing his partner and then setting fire to his flat after hearing his victim was HIV positive.