You could just abuse the fire/rehire glitch. But that doesn't work for Charon and Jericho.
There's also the Puppies! perk glitch: kill Dogmeat in the same room as the companion you want, and then hire him/her. When you leave the room, you'll get a message saying Dogmeat's puppy is waiting at Vault 101 -- this opens a companion slot! Just do the same as you did before and you can get all the companions in the game.
The other way is the Sergeant RL-3 glitch. Hire RL-3 and then tell him to wait. Speak to him again and tell him he's fired. Go to an indoor location (being outside negates the glitch, for some reason) and 'Wait' until you get a message saying Rl-3 is at Canterburry Commons. This requires patience as it can take a while, but you'll open a companion slot.
Go to the companion you want to hire and get him, then go back to RL-3 and repeat the process to open another slot.
If I have made a mistake here, then I apologise, and I hope someone will correct me.
EDIT: Ninja'd! Damn you, llama! Damn you to hell!