Try developing a sense for phrase length rather than just counting the beat.
Try breaking things down to 2 bar phrases with attention to how you "cross the barline." Place the continuous rhythmic flow over the bar line, like these patterns...

Try simple broken chord and scale lines and count out loud. The point isn't to play fast, complex lines. It's to hear the flow of chord changes and the timing of phrases. Rather than just counting beats, you want to get the feel of a 2 bar phrase length whether the rhythm is on the beat, syncopated, or anacrusis (pick up line.)
You can extend the phrase length by prolonging the rhythm mid-phrase.
Two bars...

...can be prolonged to three...

Another example...

Don't try throwing everything and the kitchen sink to the rhythm patterns. Two simple patterns are enough. Use repetition, truncation, and prolongation of those patterns to develop new phrases and build the whole improvisation.
Remember that space is something to use. Rest help shape a line. Pick up lines fill space, but because they are metrically weak (don't start on beat one) they feel like part of a new line. So a three bar line can fill the space of 4 bar simply by using the fourth bar to give a rest to give a clear end to one phrase and start the pickup to the next...

When you think in phrases it seems you naturally start to think more about where you plan to end the line. Instead starting a line and then sort of chase the chord changes, trying to keep up, counting to make sure you don't forget to change at the right time, it's more like thinking 'I'm going to F7, but through C6` or something similar.
Regarding what tones to actually play, keep in mind there are only two basic harmonic categories for this two bar approach: the chord stays the same, the chord changes. Keep things simple. If you focus on the common tone between chords, then only one tone is necessary! If you want to change tones, a single step is usually the only thing needed to make the line follow the chords. So, that's just one tone or two tones to build the line from. You can elaborate those tones with neighboring tones to dress things up. The point in keeping the line simple is to shift the attitude away from thinking melody is all about pitch and feeling how important rhythm is to creating a good line. That should get help you know where you are in the music.