My 5-year-old has looked at a PBJ sandwich, said "Hey! This looks like a gun!" and did a make believe gun play. There's only so much you can do.
I refuse to buy any guns that seem even slightly realistic, but I can be persuaded into purchasing a water gun or a Nerf foam dart gun, always getting the one that looks the LEAST like a real gun. (For the Nerf foam darts, the whole POINT is to play a game of tag safely, so the "don't point" rules may have to be tweaked.) He's got a Buzz with a "laser shooter" and an Emperor Zurg that shoots foam darts.
Basically, I try not to make HUGE deal about it, but any gun play usually is accompanied by at least some warnings or mini-lectures. The main point I stress is that when kids play with toy guns, they might find a real gun and think it's a toy. And I've used Google to find pictures of real guns that LOOK like toys and I ask if he can tell whether the picture is a real gun or a toy. (One the google page, there's an option for "Images" that searches for photos.)
Then there's the whole "BB gun as a toy" that comes up in movies like "A Christmas Story" and "Home Alone". You might point out that people weren't always as safe back then - "They didn't even use car seats!! Can you BELIEVE it?!?" - and a lot of kids got hurt, so most parents don't give kids BB guns anymore.
It helps that most schools and camps that have a costume or dress-up day don't allow toy guns, swords, or other weapons even if your kid is dressed like a pirate, knight, or ninja. I also don't let him take toy weapons to friend's houses, saying that "Ms. Lisa probably doesn't let Jimmy play with those kinds of toys - lots of parents have stricter rules than we do." (Sometimes even if I know Lisa has more toy weapons than our house.)
Toy stores like "Toys R Us" have entire rows of toys in the boys section that are downright disturbing, (not to mention the fact that they have VERY few things out for the kids to play with, so the whole "visit to Toys R Us"
that seems like a fun idea just frustrates them), so I go alone or take them to toy stores like "My Storyhouse Toys" in Roswell and "Learning Express" where they have MUCH better selections and lots of things on display for them to actually play with.)
IF you think he's mature enough, you can relate true stories of children that have been killed by guns because they thought it was a toy or wasn't loaded. Sooner or later, it will come up in the news, or even better,you can probably find a few stories from people you know if the subject comes up. Here's 2: (1)My friend had a childhood classmate who got killed when he played at a friend's house. The father was a police officer, who was so exhausted that he crashed out on his bed that day with his firearm on the nightstand (instead of securing it as he ALWAYS did). He had taught his own child gun safety, but the neighbor's child thought it was a toy. (2) I told my son about a great-uncle who, when he was 8 ("much older than you"), woke up very early one morning found his father's hunting rifle and woke up the whole house when the gun went off. He didn't survive. His sister told me the story in her 80s because it was the saddest day of her life.