The best food I've found is peanut butter - you can by organic if that's a concern for you - but smooth peanut butter is high calorie, contains the "good" rather than "bad" fats, cheap and easily available, and tastes good!
But I can't imagine how you'd get in 4000 calories no matter what you eat!
I also thought the average adult male eats more than 2000, more like 2500. 2000 is supposed to be the recommended average female calorie needs.
It varies a lot depending on how tall you are, etc. too.
I'm not sure you'd need 4000 calories a day to gain weight. Surely if you are able to eat a little over your calorie needs (so if you need 2500, maybe eat 2700) you'll still gain weight, just more slowly. Is there some medical reason you need to gain very quickly?
What problems led to you being underweight in the first place? A lack of appetite and/or malabsorbtion?
You might have seen I've posted a lot about how I struggle to keep weight on. I'm eating around 1500 calories a day now, and my weight is stable but I'm not gaining any. When I have ileostomy surgery soon they're going to try a feeding tube so I don't starve to death while recovering.
To be honest I think there's no way I can eat enough to maintain a healthy weight just through regular eating anymore. I'm already on Ensure plus and Fortisip supplements.
I felt just as awful at a healthy weight as I do underweight. Worse in fact, as being a healthy weight makes my hormone problems worse, and all the extra food required makes my Crohn's symptoms a lot worse. So I think I'm lacking motivation, because I'm not even sure I'll be healthier when I weigh more - I certainly won't feel healthier.
If you've done all the obvious things like supplements and high calorie foods it might be that like me you need medical issues addressed. If there's something causing you problems with appetite or problems absorbing food, it might be that needs to be identified and treated, if possible. I guess you've already considered any obvious cause such as a medication suppressing appetite? Is a feeding tube something you'd consider? I'm not sure if it's going to help me but I'm running out of options.