It happened at an eight unit rooming house on the 5500 block of Hunter Street.
Authorities received numerous 911 calls shortly before 12 a.m. Wednesday.
Police say the suspect entered the building through an open front door. Six people were inside at the time.
"He's standing at the top of the step with a black hoodie on," resident Keith Croxton told Action News. "He got the gun like this. He said 'Come up the steps.' By the time I get to the top of the steps, he takes the gun and went 'Bam!' and hit me in the back of the head."
Croxton was led into an upstairs room where other residents were already gathered. His friend, a man in his 50's, had also been pistol-whipped.
"He made us all lay on the floor," Croxton said.
Another resident showed up and was forced into the room as well. Then the 30-year-old victim came home.
"He seen them with the gun," said Croxton. "So he must be trying to run out the door. By that time, all you heard was 'Pow!'"
The victim was shot once in the back. The suspect fled, and residents called police.
The victim was rushed to Penn Presbyterian Medical Center, where he remains in critical condition.
Back at the scene, police say his room had been ransacked.
"At this time we know there was one cell phone taken that we were unable to track," said Philadelphia Police Chief Inspector Scott Small.
The case remains under investigation.
Send a News Tip to Action News
Learn More About 6abc Apps