There are 5 levels of upgrades for machines. I can confirm that.
There are at least 5 levels of upgrades for the pills. Since I'm only at level 4 with one of the pills, I am not completely sure whether level 5 is the end or if it goes on. (there is an achievement that tells you to upgrade pills to level 5, so it's safe to assume there's a level 5 )