Daniel Wayne Surette and Kyle David James Fredericks appeared in Kentville court to enter their pleas.
The pair will be sentenced April 28. Second-degree murder carries an automatic life sentence, with no chance of parole for between 10 and 25 years.
Lawrence was found inside a burned-out bus shelter on Commercial Street in Berwick on Oct. 23, 2013.
The court was told Monday that Surette and Fredericks bought $10 worth of gasoline and then poured it over Lawrence, and set him on fire.
During a preliminary inquiry earlier this month, the court heard testimony from Becky Surette, Daniel Surette's mother. She said everyone in Berwick knew Harley Lawrence, but there was a rumour he was an undercover officer.
She said her son and Fredericks sold drugs to buy party supplies, which included hard liquor, four dozen beer, cocaine, dilaudid, ecstasy and marijuana.
Becky Surette testified her son arrived home the night Lawrence was killed and told her, "Mom, I did something bad to the homeless guy."
Police also used security video from various local businesses to figure out the movements of Surette and Fredericks leading up to the killing.
Both men told Justice Gregory Wagner they understand they will serve at least 10 years in prison before having a chance at parole.
It took six months for police to declare Lawrence's death a homicide, and some time after that before Surette and Fredericks were charged.