That's probably true, but I can tell you that in my previous two jobs, I said "no" a lot, and I basically managed to maneuver into a spot where my boss let me essentially work on what I wanted. I got raises and commendations. I was surprised, but it's like, to some extent, the more assertive and confident you are, the more they respect you.
My personal experience has been that when it comes to getting promotions/raises, being liked by your coworkers (including your boss) is 10X more important than the amount of output you produce. You should try to be on friendly terms with your boss... And of course, if a friend asks you to do something, sometimes you say yes, sometimes you say "I would like to help, but I'm feeling saturated with the projects I already have going on right now, to be honest", and a good friend/manager understands that.
An extra dimension to this is that you don't necessarily need to get promoted in your current job. In the software industry, it's easy to move from one job to another, and when you move laterally, you can often negotiate a better salary. Again, here, being liked by your coworkers is particularly important. If your coworkers like you, they will give you good referrals. If you can get a referral from your previous boss, that speaks volumes.