I grew up in a house chock full of guns, many of them loaded, and there wasn't a gunsafe in the entire place. A few simple procedures kept myself and my younger brother completely fine for our entire time growing up.
1. It's a 4 year old. He can't possibly be more than about 2 feet tall. There are many, many places in that house that a loaded gun can be placed where it will be available at a moments notice to any ADULT in the house that needs it, yet the child won't even have a clue it's there. A shotgun or short barreled rifle on top of a wide book case or tall wall cabinet is completely invisible and unreachable to the child, yet can be grabbed instantly in a home invasion. A pistol can easily be kept in the same places. I wall mounted "key holder" usually has a large, deep tray underneath for putting knick-knacks and stuff in. Perfect place for a loaded pistol. A rifle, shotgun, or pistol can also be hung on the wall that is loaded and only within reach of an adult. It's visible to the child, so the temptation to build something or climb something to get up there may be present. They've really got to be working at it though.
2. You don't need a gun safe to secure guns. They used to make very stiff rubber bands/slings that lock the slide on an autopistol, or the hammer on a revolver. I'm sure you can still get them. A divot goes into the barrel on one end, and the band wraps around the back of the handgun. It takes adult strength to pull one off. It can be done in an instant, but a child isn't going to get it off by themselves.
3. As others have said, train the kid gun safety, at a proper age. At 4, he probably shouldn't be messing with them at all. Teach him not to touch it, and to call an adult if he finds one. Sometime around age 5-6, depending on maturity, is the time to start reinforcing safe gun handling, with an emphasis on NEVER touching one without a responsible adult present. It is up to the parent to define who specifically is a responsible adult. Another good tool is to reinforce the use of "toy guns." We were never allowed to point toy guns at each other, or act like we were shooting each other. Toy guns being treated like real weapons is a great way to enforce safety while still having fun.
4. Whenever an adult isn't going to be present (i.e., leaving the house, outside for a long period of time, etc.) or the child is going to have friends over at all (even if they are gun safety trained), all firearms should be moved to an out of the way room (non-essential to travel through or into), and the door should be locked. You simply cannot trust kids around other kids, and you cannot trust them when you aren't home, no matter how well behaved you think they might be.
5. Discipline. Simply put, if you are going to expose a kid to a situation where he could easily get himself killed, you're going to have to leave some of the cutesy kidsy stuff behind and get tough early. That kid has to think you have eyes in the back of your head, that you can read fingerprints that are a week old on any surface, and that you have the dust pattern memorized on every gun in the house. He also has to have the fear of God instilled in him as to what you would do if you found out he had handled a firearm in an improper manner (i.e., when you aren't directly there supervising). I didn't avoid handling firearms all those years because I was such a great kid, or because I was smart enough to realize the consequences of how bad handling one could go. As a child, I reasoned on a much lower level, and I was simply scared to death of what SSgt Dad would do when he found out I had handled one when I wasn't supposed to. There was no question of IF he would find out, as silly as that seems, it was just a given for me that he would.
There's a reason that discipline is so much tougher on an 18-22 year old kid in the military than one living in the dorm room. One of them is the fact that the young man or woman in the military has a lot more deadly equipment and opportunities to get killed floating around than their civilian counterpart does. Danger necessitates discipline, and with discipline, eventually comes responsibility.
I can honestly say that I spent the first 16 years of my life without ever handling a gun when I wasn't supposed to be. After that, I was given a little more free reign, but still had to have at least one of my parents check the weapon to make sure it wasn't loaded before I started dryfiring, working on it, or packing it up to go shooting. Good lessons instilled young last a life-time. Bad or no lessons at a young age are a recipe for disaster.