I hope it's pretty simple. What is the best program to both gain some muscle mass/strenght and gain endurance ? Would it better to alternate frequently (every 1-2 days) between cardio training and weight lifting or go for a smaller frequency (1-2 weeks) ? In case this matters, I have a BMI of about 20 that I plan to get to about 23 and I can run a semi-marathon but I'm aiming for a Half-Ironman.
Most important principle in programming is the SAID principle: Specific Adaptations To Imposed Demands.
That means your body will respond to the demands you put on it. Please review this article called "Death By Prowler", in particular the section on energy systems. The big take away is that marathon running and weightlifting require opposing adaptations. As such, your body will do the best it can to compromise with the stresses you are imposing.
Best Case: Alternate Emphasis
If you have the time to plan out your training, you will give more emphasis to the activity you need most at the time. If you are preparing for a race, the natural emphasis is going to be on your running program. If you are preparing for a lifting competition, the natural emphasis will be on your strength training.
In the running off season, you can maintain a decent level of conditioning by running an easy 5k twice a week. The effort should be in the aerobic zone, and it's purpose is just maintenance. This is where you'll spend more time strength training.
In the running season, you'll lift 2x a week using a program like Wendler 5/3/1 (there's different variations) and not worry too much about increasing weight. Perhaps work on increasing reps--which also helps with muscular endurance.
Worst Case: Training Both Simultaneously
A friend of mine agreed to do a power lifting competition with me, and then a few weeks later told me he entered the Marine Corp Marathon. The race date and competition dates are only a couple weeks apart. This is going to be a rough time of training, particularly because the legs are getting fatigued from the running and the lifting.
I'm still feeling out the specifics on this. Since I'm acting as my friend's strength coach, I'm going to have to monitor and adapt his programming. Currently, his squats are having problems, and a good reason for that can be the fatigue from running. I'm going to have to tweak the strength programming a bit to help him realize his goals.
One way to achieve added muscle like this is to gradually add heavier weights to your endurance training. For example, instead of just running you could run while pulling weights or a weighted sled. You can also use hills to add difficulty by letting gravity give the feeling of added weight.
That being said, if you're running long distance races you may not want to do too much bulking up. I'm personally a big fan of circuit training because you get the combined cardio and strength training. If you limit yourself to your own body weight or to moderately heavy weights, then you'll still gain lean muscle.