It's common to hear the idea that guitarists need pitch and drummers need rhythm. These are both half true, as guitarists and drummers need both pitch and rhythm.
Could you imagine what a duo band like the Black Keys would sound like if Dan Auerbach had bad rhythm? Not so great. Playing great riffs out of time is sort of like driving a Ferrari into a wall.
You'll also need good rhythm for your solos. Guitarists may have a reputation of wanting to play as fast as they can, but as the old Yngwie proverb goes (I'm actually not sure if he ever said this), “Playing slower in time sounds faster than playing super fast out of time."
So here are some fun ways to develop rhythm for solos and rhythm playing.
One reason people play rhythm parts out of time is because they don't know/feel the subdivisions of the beat they're playing to. Sixteenth notes and sextuplets and general funk strumming can seem overwhelming, so it's good to start simple and build from there.
There are a few ways to do this. The first is to use a metronome and slow your rhythm part way-y-y down. When playing a part slower, it forces you to feel the subdivisions of the beat and really understand the rhythm of the riff. On most metronome apps, there are options to subdivide the beat into eight notes, triplets, etc., for help.
Say you're playing the awesome verse riff from Muse's song “Unnatural Selection” that starts around 48 seconds in. Sloppy playing on a riff like that would completely ruin the vibe of the verse, and if it's tough for you to play speed-wise, your arm will get tired and you'll slow down the riff. You don't have to spend two hours practicing this riff or anything, but 10 minutes of starting at a slow tempo like 90 bpm then building up 8 bpm at a time after a minute of playing the riff is a good idea.
Another good way to tell if you're playing tight is recording yourself along with the song. Using a program like garageband and having something convenient like a guitar-cable-to-USB-adapter around makes recording yourself very easy. Just upload your favorite cover(s) to play, pan it left and you right, play along, and then listen back very critically.
Things to look for: Are you locking in with the groove? Are you in tune? How is your tone in relation to the guitar on the song (more/less saturation, brighter/darker, more/less reverb, etc.)? Is your pick attack too strong/too weak? Although it sounds so good, I'd recommend using no reverb/delay as to get the most accurate representation of your playing.
Learning how to keep time with your soloing gets a little trickier. A great way to understand your licks better is to move them over an 8th or 16th note. Take Example 1: Normal descending A minor blues-rocky lick. No surprises here.
Example 2, though, moves it over an eighth, which doesn't seem difficult until the ending. Bouncing the last notes off the first beat of the next measure will feel much different.
The toughest, and my favorite, is Example 3. This is the same lick but moved over a 16th note, which can feel tricky at fast tempos. Use a metronome and try the examples back to back several times, transpose them, then try to use them in a solo. Do this with your other licks too, and 1. You'll have a better grasp of time and 2. You will have some new licks.
Hope this helps! Feel free to post any questions in the comments section.