Self-Pleasure to Thoughts of Spouse
Is masturbation a sin if there is no climax and my thoughts are about my wife?
If it is exactly as you describe it, then I would say there is no grave sin. However, there might be if you made this a regular practice, since obviously you are exposing yourself to the possibility of a completed act the more you do this, and that looks like not avoiding the near occasion of sin. If you are away from your wife, or she is ill and unable to join with you, it would be better to avoid doing this and just work on offering to God the waiting until you can come together again.
In any case, the Lord is merciful, and the most important thing is that your thoughts are for your wife alone and that you are resolute not to choose any acts that are against the procreative end of marriage.