Police say Ryan Squiers entered the apartment pistol-whipped the man while demanding money from him. But the man fought back and shouted for his roommate, who joined in the fight and took away Squiers' gun.
Squiers pulled a knife, but the victim and his roommate took that away, and they held Squiers until police arrived.
Squiers was charged with attempted robbery, three weapon charges, assault, aggravated menacing and drug charges. He is being held at Young Correctional Institution on $144,500 bail.
Click here to get the latest Philadelphia news and headlines from across the Delaware and Lehigh valleys.