The primary natural tension in Dominion is that you need victory cards to win, but those cards actively hurt your deck's ability to function. I believe that this is at the core of the greatness of the game, and a big part of what sets it apart from most other deck-builders. In terms of gameplay, what often happens is that the game is led to a position wherein one player - I will call her the "Pace-Setter" - takes a points lead, hoping to ride that to the end of the game, and the other player - I will call her the "Chaser" - delays greening for some time, hoping to ride their superior deck quality to overtake the Pace-Setter before the game ends.
Play as the Chaser
The most important thing here is that you need to have a good understanding of how much time you have. This means that you need to have a very good understanding of what your opponent's deck is capable of. You have a big question of when to green, and as with most tricky decisions, there are pressures coming from both sides. On the one hand, you want to move to greening sooner, because if you wait too long, then your opponent will simply lock you out by getting too many points for you to overcome. On the other hand, if you green too soon, you risk not having enough fuel to finish your comeback, sputtering out, and losing.
In practice, the latter is a much bigger problem than the former, at least for most players I've seen. The number one biggest problem I see for people in this role is that they panic, green too soon, and can't finish the job. I think this is a fairly natural reaction, as you see that you're behind on points, which makes you feel like you need to do something, and furthermore, it's easy to see what the Pace-Setter's deck is capable of right now and extrapolate that forward, not taking into account that this will deteriorate as they green.
In general (and there are lots of further factors that lead to exceptions to this rule), you should continue to build your deck until the point where if you wait any longer, your opponent will likely be able to lock you out. The bigger your lead (in terms of game positioning, not points), the more you want to protect against them having fortunate draws by turning for green slightly earlier yourself (this can in some cases also protect against you having bad draws yourself, though this is situational, as sometimes you're better off buying more components that give consistency). The more you are behind (again, this is in a game position scenario, not a point count), the more you need to play for the opponent to have deterioration, even if that's unlikely. Nothing is worse than turning for green when you yourself have insufficient deck quality to ever get through everything.
You always need to have a plan to actually win - just closing the gap somewhat is meaningless, as margin of victory (or loss) doesn't actually count for anything.
Play as the Pace-Setter
When you dive in and take a points lead, your goal needs to be focused on ending the game. It's not about scoring the most points as fast as possible, it's about having a lead when the game is over. This means you want your deck to be sufficiently built-up that you won't stall out completely before you can put the game away. At the same time, you need to make sure that you aren't going so slowly that your opponent can just turn to green and take the lead while still having the better deck.
You are generally trying to do one of two things in order to end the game: empty the Provinces (or Colonies), or take an insurmountable lead. The classic example of an insurmountable lead is having half of the VP in the supply, such that even getting every single point remaining, your opponent will still be behind; however, in practice, you usually don't need to go quite that far, as getting all the Estates together with other, expensive things, will usually prove to be prohibitive for a Chaser.
Which of these you go for depends a LOT on the particular circumstances of the board and game. However, the big question often comes down to what other kind of points are available; if there are only the standard ones, you usually go for Insurmountable Lead. Generally, this is only going to change if there is some reservoir of points which it's much easier for them to tap into than you, but it will change in those cases. The important factor, though, is that you keep building your economy with whatever particular goal in mind - you need to be able to power through to the end without sputtering out - but not so much that you lose your speed edge.
One last thing I want to mention is that, while you generally want to pick some method of closing out the game and focus that down, if you can afford to have flexibility, that's a definite positive. For instance, your opponent is likely to be building for quite a while, and if you can pick up some components which are necessary for them and only marginally worse than the alternative for you, it can sometimes be worth it - especially if this can also threaten pile endings. This won't come up terribly often, but it's the kind of thing to be on the lookout for.