The boy, who was with his apprehended father, had been transferred to a New Mexico medical center showing signs of sickness on Monday, the agency said.
Staff diagnosed him with a cold but later discovered a fever. He was released at midday, with prescriptions for ibuprofen and the antibiotic amoxicillin.
The child was later transferred back to the hospital after showing signs of nausea and vomiting, and died just after midnight.
The CBP said it had not established the cause of death but would "ensure an independent and thorough review of the circumstances."
Guatemala called on US authorities to conduct a "clear" investigation of the death, adding that "medical reports have been requested... to clarify the cause of death of the child."
The news of the boy's death triggered outrage on social media.
"Another child dies under this Administration's watch," tweeted Democratic Congressman Marc Veasey of Texas.
"Such a devastating story to hear on Christmas Day."
"Heartbroken and sickened by this news," Senator Martin Heinrich of New Mexico wrote on Twitter.
"I am urgently demanding more details, but the Trump administration must be held accountable for this child's death and all the lives they have put in danger with their intentional chaos and disregard for human life," he tweeted.
- 'Searching for a dream' -
The boy's death came on the same day that Jakelin Caal, a Guatemalan migrant girl who died in US custody under similar circumstances earlier this month, was buried.
Her body was repatriated on Sunday and after a long journey reached the remote village where her family lives without electricity and other basic services.
"This girl left home happy searching for a dream, but unfortunately died on the way," community leader Alberto Pop told AFP in the cemetery in the community of Maya Q'eqchi'.
"You hear that in the United States they pay well, not like the companies here in Guatemala -- that's why people leave," said Pop, whose 22-year-old son Joaquin left in November in search of the American dream.
"I don't know if he is alive or dead," Pop said.
"Unfortunately, these decisions (to migrate) are made because of scarce economic resources," Jakelin's cousin Mario Caal said at the funeral.
Jakelin Caal's December 8 death reignited debate in the United States over immigration policy and the treatment of migrants.
President Donald Trump has made hardline immigration policies a central plank of his presidency, drawing fire from critics who accuse him of demonizing migrants for political gain.
He is locked in a battle with Congress over funding for his planned border wall, which he claims will stem migration from Latin American countries plagued by gang violence and poverty.
"Heartbroken to hear of a second child's death in CBP custody," tweeted Nydia Velazquez, a Democratic congresswoman from New York.
"We must demand accountability, find answers and put an end to this Administration's hateful, dangerous anti-immigrant policies."