Pick up every gun you come across, weapons that use ammo will give you one full magazine's worth of ammo when looted.
It's also worth clearing our Raider and Gunner bases to find their stashes as well. Places like military forts and bunkers, as well as law enforcement buildings will no doubt have security lockers filled with weapons and ammo. They can also grab ammo on their own if they are carrying the right weapons. If you don't want them wasting ammo, make them trade it back to you. If you give them another weapon and have them equip it - they'll need consume ammo to keep using. Every human companion has a default weapon that they have unlimited ammo for. For example, having a Pipe weapon (with ammo that can be found easily) a laser weapon (with less abundant ammo sources) and a sniper rifle (rare ammo) lets you fall back to other options.