How can I use gear to optimize storage space in my stash?
Solution 1:
Your approach, Pillbox+Azimut merely achieves 28 items / 16 slots (not even doubling your available space).
With the LBT-1961A rig (18 items / 9 slots = 100% more slots) or Velocity Systems vest (24 items / 12 slots = 100% more slots) you can achieve better compression, and with the former option you can even store two 2x2 items.
If you cannot get your hands on enough high-compression ratio rigs, combining them with backpacks that are bigger inside (pillbox, beta) helps somewhat, albeit a 25 slot beta backpack containing two LBT totalling 30-18+36=48 slots inside is slightly less space-efficient than just the rigs.
The Tarkov wiki has a sortable Efficiency table header where you can keep these numbers easily comparable and up to date for future patches.
Solution 2:
You essentially have two ways of increasing your effective storage space: Make more space, and make the stored items smaller.
How to Make More Space
As you already correctly identified, some containers have more storage space on the inside than they do on the outside. For the sake of clarity, let's refer to this as "positive space". So an item like the Lucky Scav Junk Box, which is 4x4 on the outside and 16x16 on the inside has a positive space of 170, which is huge! Others, like the Pillbox, only have a positive space of 4, with the downside that the pillbox cannot store more copies of itself inside, so you cannot create an infinitely deep stack of backpacks to generate infinite space.
The best way of generating more space is through the use of Containers. The Scav Junkbox is specialized in storing barter items, which may be used for hideout upgrades, as well as for quests.
The other container you gain access to somewhat early in a wipe is the Ammunition Case, which is available from Mechanic LL1 in a barter for 2 thermite and 2 green gunpowder (Eagle). While these aren't super common, they're common enough that you'll be able to buy a new one every couple of days. While I personally like buying one for each caliber I use, you can be more efficient by just buying a new one when space runs low.
Scav Wallets can be found on dead Scavs and as far as I remember, you can also spawn with one in your inventory when you play as Scav. They're 1x1 in size, but can hold 2x2 inventory inside, which you'll likely fill up with Ruble. So instead of half a million Ruble, one inventory space can now hold 2 million.
Once you unlock Therapist LL2, you'll be able to barter for the Documents Case, which is 1x2 in size and can hold 4x4 in size. This means it can hold a total of 8 million Ruble inside, which is twice as much per inventory space than a Wallet.
You can further optimize this by buying the aptly named Bank Robber chest rig, which is 2x3 in size, yet holds four 1x2 slots. So one Bank Robber chest rig can hold a grand total of 32 million Ruble. This is far better than the Money Case, which is also 2x3 in size, but can only hold 24.5 million Ruble.
Also available from Therapist LL2 is the Medicine Case, which is available for Bloodsets, Syringes, Lip Balm and Medical Tools - all of which are somewhat common loot. It's 3x3 in size, yet can contain 7x7 inside (so positive space of 40) and can hold all your AFAKs and IFAKs, Bandages, CALOKs, Painkillers and various Syringes.
The Magazine Case and Grenade Case are both available as crafts from the Lavatory Level 2, needing small and large fuel tanks respectively. Be aware that you can use your fuel tanks until depletion before making the crafts, else you'll waste the fuel inside.
This only leaves Armor, Chest Rigs, Weapons and Weapon Mods in the stash without any containers. Once you reach level 15, you can purchase a T H I C C Weapons Case for ~10 million Ruble, which holds 6x15 inside, while itself only taking up 2x5. This should be enough to hold ~20 weapons per case, depending on what kind of weapons you usually keep.
The Chest Rigs you own can also be put to good use. Most chest rigs have 1x2 slots available, which are perfect to fit pistols inside, as well as SMGs (see below).
Additionally, increasing your Stash level should be top-priority, if you do not own the Edge of Darkness edition. Materials for the Lv. 2 upgrade can be found with relative ease and do not require any particular Loyalty Levels with any trader. The Lv. 3 upgrade requires Prapor LL3 and Ragman LL3, which means you need to be at least Lv. 32.
How to Make the Stored Items Smaller
Weapons are big, as you've surely noticed. A typical AK is ~2x4 or 2x5 in size, depending on which muzzle devices and which stocks you have attached. But this size can be greatly reduced by removing the magazines and removing the grip of the weapon. Suddenly, a 2x5 AK becomes 1x5 in size, with a 1x2 magazine and 1x1 grip detached. This already saved two inventory spaces, but the newly shrunk AK can now be placed into the above-mentioned weapons case very compactly, while the magazine and grip can either be stored in a chest rig, or sold.
You see, if the magazine or grip aren't special in any way, then the additional storage space you get from selling the magazine or the grip are more valuable than those items by themselves. And the chest rigs you already have are perfect to store all those good grips and other weapon mods you have.
Furthermore, many weapon mods can also attached to other weapon mods for the same or sometimes even less space. For example, the Zenit B-13V "Klassika" dovetail rail platform is only 1x1 in size, yet can fit an ELCAN SpecterDR scope on it. By attaching it, you turn a 1x2 scope into a 1x1 item.
Similarly, the Zenit B-10M+B-19 handguard is only 1x1 in size, yet can fit a red dot, two tactical devices and a foregrip.
How much is too much?
At some point, you will lose oversight over what you have and where it is. I cannot tell you how often I just knew I had some part, but just couldn't find it anywhere. You see, in the "Weapon Modding" screen, you see which parts you have available, but only if those parts are laying around by themselves. If you, for example, put an optic onto a rail and then store that rail somewhere, the game will not show you that optic as "in your stash".
So as a result, you have to ask yourself the question when enough is enough. Does it really make sense to store all these TBLs when you can just buy them new from Skier for a couple of Ruble? Sometimes it's better to own less and make good use out of it, than to hoard like a madman and say "I'll use it eventually" and then lose it all when the next wipe comes.