Police said 21-year-old Seth Dillon of North Versailles was in a Wilmerding home when 18-year-old Shawn Januck was shot on Friday night.
Police said in court documents that Dillon told investigators that he and the victim were standing in the kitchen with Dillon's gun lying on a table.
Investigators said he told them that when he picked up the gun, it discharged, hitting Januck in the head.
The Pittsburgh Tribune-Review says witnesses told police that Dillon said he didn't know the gun was loaded.
Dillon was charged with a criminal homicide and a firearms crime; a listed number for him could not be found and it was unclear whether he had an attorney.