Here's what happened:
* The hound was a real animal, but not supernatural. It was a large, fierce hound trained by Stapleton, the villain, to attack Sir Henry Baskerville.
* Holmes anticipated the attack, and used the darkness and the moors to his advantage. He knew Stapleton would try to lure the hound onto the moor using a lantern to guide its path.
* Holmes and Watson set up an ambush, hiding in the shadows and waiting for the hound. When it arrived, Holmes fired a shot in the air, startling the hound.
* The hound, confused and scared, ran off into the darkness. It was never found again.
The key point is that the hound wasn't killed. It was simply scared away, leaving Sir Henry safe.