"How can I play rhythm and lead guitar together?" I get this question a lot from my students. The answer is complex and has many in-roads, however, fundamentally it begins with being able to keep track of musical space. How can you play leads if you don't know what the chords (you have removed in order to play the lead) are?
Here's a simple exercise to start building awareness.
Goals:
1. Improve sense of feel; be able to keep the beat.
2. Depart from rhythmic obligations on beat four; do a lick on beat four lasting only the length of that beat.
3. Retain harmonic sensibilities of the rhythm guitar (your "memory of the chord") as you pursue lead ideas.
4. Return to rhythmic obligations on beat one. Explore the many ways the fretting hand needs to adapt based on where the lead on beat four ended up.
5. Fully absorb the sense of musical space you are creating as a rhythm player so you can further depart from rhythm obligations to do more leads.
If you would like to dive deeper into this or related concepts, you can learn more about me here: https://walkerguitarlessons.com