Darren Fresco said he asked Pistorius immediately after the sunroof shooting if he was "mad" and the world-famous runner "just laughed" at him.
Pistorius denies shooting the gun in the car, although now two witnesses say that he did.
Fresco's testimony portrayed Pistorius as a reckless hothead who also asked Fresco to take the blame for a gun being fired accidentally under a table in a busy Johannesburg restaurant.
But Fresco's account appeared to be undermined when Pistorius' defence lawyer created doubts over Fresco's recollection of some events. Fresco responded to a number of questions from Barry Roux on cross-examination by saying he didn't remember. He also said he'd been following some previous testimony in the case on Twitter, which witnesses should not do.
Pistorius, 27, is on trial for murder for the shooting death of girlfriend Reeva Steenkamp on Valentine's Day last year, but also faces two firearm charges for shooting in public and a third firearm charge for illegal possession of ammunition.
Pistorius, the first double-amputee runner to compete at the Olympics, pleaded not guilty to all four charges against him. He specifically denies that he fired the gun in the car, Roux said.
Pistorius' demeanour in court was drastically different Tuesday to the vomiting, retching defendant who needed a bucket to throw up in on Monday as he heard a pathologist give graphic details of the injuries he inflicted on his girlfriend when he shot her multiple times through a toilet door in his home on Feb. 14 last year.
This time, instead of hunched over and heaving, Pistorius mostly sat with his hands in his lap in the Pretoria courtroom and often made notes. He denies murder in Steenkamp's killing saying he shot her by mistake thinking she was a dangerous intruder.
Fresco, who said he was driving the car during the alleged sunroof shooting in late 2012, and a former girlfriend of Pistorius have both testified that Pistorius shot his gun out the car.
But their stories didn't match in parts: Fresco said Pistorius fired without warning sometime after they were stopped by traffic police and after visiting an unidentified person's house. Samantha Taylor, who said she was dating Pistorius at the time, has testified that it happened soon after the altercation with police and after Pistorius and Fresco discussed finding a traffic light to shoot at.
Fresco said the group was pulled over, for the second time that day, and Pistorius was furious with an officer for handling his gun, which he had left on the passenger seat.
"You can't just touch another man's gun," Pistorius said to the officer, according to Fresco. "Now your fingerprints are all over my gun. So if something happens, you're going to be liable for anything that happens."
Later, Pistorius shot out the sunroof, Fresco said.
"Without prior warning, he shot out the sunroof," Fresco said. Fresco said he was driving, Pistorius was in the passenger seat and Taylor in the back.
Fresco said he "instinctively" moved away from where the gun was shot.
"I said to him, are you (expletive) mad?" Fresco said in his testimony.
"He just laughed," Fresco recalled. "But it felt as if my ear was already bleeding."
Defence lawyer Roux pointed out that Taylor had a different version.
Roux also questioned Fresco on the incident at a packed Johannesburg restaurant in the posh Melrose Arch district in early 2013 when he handed his gun, a Glock 27 .40-calibre pistol, under the table to Pistorius and it fired. Fresco said Pistorius asked him to take the blame for the incident, which he did, because Pistorius feared bad publicity. It was about a month before Pistorius killed Steenkamp.
Fresco said he had warned Pistorius that the gun was "one-up," meaning it had a bullet in the chamber.
"I knew that he had a big love for weapons ... my assumption was that he had competency," Fresco testified.
Roux asked Fresco when exactly he had warned Pistorius that there was a magazine in the gun and a bullet in the chamber, and when Pistorius had asked him to take the rap. The friend couldn't pinpoint the precise times.
"Will you agree, Mr. Fresco, you have uncertainty ... about what specifically happened and what was said?" Roux said.
The only time Pistorius appeared uncomfortable Tuesday was when the pathologist who performed the autopsy on his girlfriend's body finished his testimony.
Prof. Gert Saymaan concluded that Steenkamp might have been able to scream during the shots that killed her. Referring, specifically, to the gunshot wound in the arm Steenkamp suffered — one of three main bullet wounds — Saymaan said it would be unusual if a person didn't scream after that kind of severe injury.
Pistorius maintains he was the only one to shout and scream on the night of the killing. Prosecutors say Steenkamp screamed during an argument and then during the shots, with witnesses testifying to hearing a woman's screams on the night. Prosecutors say Pistorius therefore knew who he was shooting at.
They have hinted that the bullet that hit Steenkamp in the head was one of the last of the four shots, giving her time to yell out.