The suggestions above all are outstanding, so I'd simply like to reiterate something that, for me, is the key for maintaining a positive cash flow. I visit my Domestic Advisor EVERY SINGLE TURN!!
It's amazing what playing around with your tax rate can do. For example, in my current game, I'm playing China. My ultimate goal is to win by space race, so I've got to keep my science rate relatively high without going broke doing it. Now, I had just spent a wad o' gold updating most of my spearmen to pikeman, so I had a mere 42 gp left. At the same time, I was in a bit of a tech race with the Americans - we were both dashing for Newton's College.
So straight to F1, my Domestic Advisor. If I pushed my science rate to 70%, I would get the Theory of Gravity in 4 turns, however, at this rate it would cost me -34gp per turn! Not good! But I HAD to have the tech, and fast, so I let it ride. The turn ends, and now I've only got 8gp.
On the next turn, it's back to the advisor. I now have 3 turns until I get TOG, and I'm still set to 70% which costs -34gp. Now I play with the lever, and behold! I drop the science rate down to 60%, but the number of turns to discovery Theory of Gravity REMAINS AT 3 TURNS! The difference is that now I'm taking in +19gp!
I've often found, though it doesn't happen every time, that when you have only 1 turn left before discovery any given tech, that you can lower your science rate as low as 10%, without effecting the number of turns it will take to discover that tech - it remains at 1 turn. I think you may be shocked at just how much gold you can make off of this one turn alone.
!!
Good luck!