Court records show the men tied up the family in the basement and Gray slashed their throats and bashed their heads with a hammer before setting their home on fire and fleeing with a computer, a wedding ring and a basket of cookies.
In a confession played for the jury during his trial, Gray said: "They kept gettin' up and they was scaring me. I remember seeing the hammer and picking it up and then I don't know who I hit first. I was just hittin' them all with the hammer.
"All I know is nobody was moving when I left there."
The well-known family's slaying rocked Virginia's capital city and was followed by the killing of another Richmond family less than a week later.
Kathryn Harvey was co-owner of a popular Richmond toy store, the World of Mirth, and Bryan Harvey was a guitarist and singer for a rock duo, House of Freaks.
Gray also confessed to participating in the slaying of 21-year-old Ashley Baskerville, her mother Mary Baskerville-Tucker and stepfather Percyell Tucker days after the Harvey deaths, but wasn't tried in that case.
Gray and Dandridge said Ashley Baskerville had served as a lookout for them during the
Harvey slayings.
Dandridge pleaded guilty to the Tucker-Baskerville slayings and is serving a life sentence.
Elizabeth Peiffer, a lawyer for Gray, said that his death may provide a measure of retribution to some, but it also took "from the world a man trying to make amends and make life better for others".
Prison officials closed a blue curtain at 8:54pm, shielding Gray from view. That is typically when officials insert the IV and place heart monitors before starting the injection.
The curtain remained closed for more than 30 minutes before it was opened and the lethal injection began, which Pfeiffer said was significantly longer than usual and concerning.
Lisa Kinney, a spokeswoman for the Virginia Department of Corrections, said that she could not explain why the curtain was closed that long.
Gray was the first Virginia inmate to be executed since convicted serial killer Alfredo Prieto received a lethal injection in October 2015. Gray's death leaves just six inmates on Virginia's death row. No other execution dates have been set.
Virginia obtained the midazolam and potassium chloride from a compounding pharmacy whose identity is secret under a new state law.
Wednesday's execution plan marked the first time Virginia sought to use midazolam to put an inmate to death and the first time any state sought to use compounded midazolam, according to Gray's lawyers.
Midazolam has come under fire after several problematic executions in other states. Critics argue that it causes inmates to suffer a painful death because it cannot reliably render them unconscious.
The US Supreme Court narrowly upheld the use of midazolam last year and the high court earlier Wednesday rejected Gray's bid to have his execution put on hold so he could challenge state plans to use the compounded version of the drug.
Gray's lawyers had asked Virginia Governor Terry McAuliffe to spare his life, saying his actions were the result of drug use aimed at numbing years of sexual abuse by his older brother when he was a child. Gray says he was high on PCP at the time of the Harvey slayings and doesn't remember much.
McAuliffe said he found no reason to intervene, adding he believed Gray received a fair trial.