>> Related: Police: Des Moines teen calls 911 from closet during home invasion
He threw himself at the burglars, the teen's family wrote on a GoFundMe page, and was shot at least three times in the neck, leg and knee.
As the sound of sirens became audible, the burglars ran away.
Officers found smashed sliding door glass when they went into the home to get the teen outside safely. They also found Rex, who at first looked dead.
While SWAT teams looked for the suspects, Rex was taken to the animal hospital.
He was eventually taken to BluePearl, where he is in the veterinary intensive care unit, receiving pain medication, antibiotics and wound care, with round-the-clock monitoring of his vital signs.
After making it through the night, the dog is now in stable condition.
As Rex recovers, people on social media have taken to calling him a "hero dog" for intervening between the burglars and the teenager.
"My nephew was protected by his eternal friend until the last bit of strength he had in him to do what his unconditional, loving instinct told him to," family member Susy Cadena said on the GoFundMe page.
The family started crowdfunding after paying large sums of money for X-rays and urgently needed medication for Rex. They hope to raise $10,000 to cover the expenses.
"Our family cannot let Rex the hero dog go without us fighting as hard as he did, to his very last bit of a strength while protecting my nephew," Cadena said.
Meanwhile, officers are still looking for the suspects, and they are trying to figure out why the house was targeted.