When he left the gun with you, was there a conversation something like "can I leave this with you till I get back?" IF there was, and you agreed, you have a verbal contract. Selling his property (the pistol) without going through all the legal processes (abandoned property, etc.) would be stealing his property, and a crime. Don't do it, no matter how tempting it is.
As mentioned, there are legal ways in most states to resolve the matter, but as each state can be a little different, the best thing you can do is to contact a local lawyer for advice.
The money you may get from the gun ( a few hundred, from the sound of things) certainly wouldn't be worth the hassle you might have to deal with if you didn't do everything in a completely legal manner.
Fate is just kind enough that the day after you sold his gun, he would show up at your door demanding his gun back, (or cash,) and maybe threating legal action if you don't come up with it!
Best advice I can give is, for now, forget about it altogether. Find a out of the way place to store it, and forget it. Don't waste your time trying to get the guy to come for it. If, after a few years, you can have it declared abandoned property, and legally yours, then do so.
Sure, it is frustrating, but you did agree to keep it for him, and no specific time table was mentioned (was it?)
You could...(evil grin) shoot the crap out of it, if you could afford it. Consider it "storage fees". How many rounds does it take to wear out a .40 cal anyway?