Ok, From my experience in mw4 and IS/Wars fights. This is ultimately down to the training of the pilot in question and his lance leader.
Basic Battlemech teamwork theory taught me that lance leader = God unless a CCO is on the field. When engaging an enemy lance or series of targets it is down to the lance leader to:
A) Know what weapons each of his team has. (he in my opinion should have been the one to chose them depending on the engagement, ie long range weapons, Mid range or Brawlers)

Decide on what weapons to use for the specific situation.
C) Ensure Weapons Dicipline so that he knows how much ammunition each of his pilots has left. Including between engagement "Ammo Check" orders.
if someone runs out of ammunition during a medium length battle then it is either down to the lance leader being over lenient with weapons dicipline or the pilot being a ****** shot.
Weapons Dicipline is essential. If you run out, you should stay out of ammunition as retreating to an MFB or ammo dump Puts the rest of the lance, Company and the operation at risk.
So my suggestion is, Lance leaders, train your men. Train yourself to know what weapons to use and when.