The undercover officers were shot Tuesday evening while trying to serve an arrest warrant. They rang the doorbell twice then used a battering ram on the door. They were wearing their police badges at the time. The shooter fired through the window, hitting one officer in the leg and the other in the hip. Both were treated and released from hospitals.
"Both of them are very, very lucky," Police Commissioner Sylvester Johnson said as he arrived at one of the hospitals with Mayor John F. Street.
The officers' names were not immediately released.
After the shooting, police took up to seven people from the house into custody, and the 16-year-old was later charged with attempted murder, possession with intent to deliver drugs, and aggravated assault, police said.
Street decried what he called a "deterioration of respect for law and order and for our police department" and urged lawmakers to help the city get illegal guns off the streets.
The shootings happened less than two weeks after Officer Chuck Cassidy, 54, was shot in the head when he walked in on a robbery at a doughnut shop on Oct. 31. He died the next day. A suspect was arrested days later in Miami and is now in custody in Philadelphia.
About 12 hours before Cassidy was shot, a traffic officer was shot in the shoulder during a chase. In September, an officer was shot in the face with a shotgun by a man who jumped out of a car during a traffic stop.
Before Cassidy's slaying, the most recent fatal shooting of a Philadelphia police officer was in May 2006.