In a deal worked out with prosecutors, Davis did not plead guilty to first-degree murder - as originally charged - but entered so-called Alford pleas to second-degree murder and a host of other charges including first-degree kidnapping and felony child abuse.
Under North Carolina law, an Alford plea means the defendant does not admit guilt, but concedes prosecutors have enough evidence to likely get a conviction.
Prosecutors say Davis gave her daughter to Mario McNeill on Nov. 10, 2009, to settle a drug debt. McNeill was convicted of Shaniya's murder and sentenced to death in May. He also was convicted of kidnapping and sexually abusing Shaniya.
Cumberland County Superior Court Judge Jim Ammons sentenced Davis to between 17 and a half and 21 years in prison.
"You had the opportunity, the means, to save Shaniya's life and you did not. You are not a good mother," he told her.
Davis made a tearful apology to Shaniya's father Brad Lockhart for raising their child in the environment she did - saying she "let her pride get in the way."
"I never said I was a perfect mother, but I was a good mother. I did what I had to do to provide. I did what I had to do to make sure they were alright. I didn't have any help from anybody," she said.
"I forgave you a long time ago and Shaniya did [too]," said Lockhart.
Davis' attorney said she pleaded guilty because she always felt "morally responsible" for what happened to Shaniya, but she also took Alford pleas to avoid the three consecutive life sentences that a first-degree murder conviction would have meant. The pleas entered Friday clear the way for a possible appeal.
The plea deal Friday came right after Judge Ammons refused to suppress evidence against Davis in a pre-trial hearing. Her lawyers had argued she was coerced into making statements to police before her arrest.
Davis' trial had been scheduled to begin Oct. 28.
Judge Ammons said Friday there is no evidence that Davis was threatened by police before or during an interview with detectives.
The defense asked for fourth police interrogation DVD to be thrown out of case. It is a recording of the interview that took place on November 14, 2009 - four days after Shaniya's disappearance. At the end of the interview, Davis admits to giving up her child - telling detectives "I just gave her over (for) $200. They were just supposed to have sex."
The defense claimed coercive and hasty techniques were used by detectives to summon the "false statement," as Davis was treated as a suspect, rather than a mother trying to help to find her daughter.
Lawyers said detectives repeatedly told her "You need to go down the right path. You need to go down the right path," and "No matter what you say, you will walk out today," creating the idea that her leaving the police department was dependent on her admitting something.
The defense claimed she was in a sensitive condition: pregnant, sick, and emotionally distraught over Shaniya's disappearance.
But prosecutors pointed out the transcript of the interview shows Davis was told that detectives could not force her to stay and talk, and they were only focused on getting her help finding her daughter.
While McNeill was sentenced to death, Davis did not face the death penalty. In all, she pleaded guilty to second-degree murder, second-degree kidnapping, first-degree sex offense, sexual servitude with a child, human trafficking, and conspiracy.
Legal experts said Davis will likely spend a total of 20 years behind bars.