When I'm playing solo, let's just say that
q = 120. Sometimes, I can't keep the tempo, sometimes I went faster or slower.
Is there any practice or technique for keeping the tempo?
The important thing is to feel the pulse of the tempo in your head as you play. Tap your foot if it helps you. When listening to music, tap your foot, clap or drum on your legs, to reinforce that instinct for rhythm.
Do, however, bear in mind that when playing unaccompanied, it's not always vital to keep a rigid tempo. Some pieces benefit from expressive changes in tempo. Others, the listener will want to hear that constant pulse, and will be disturbed if you change it.
Work out what causes you to speed up or slow down. Some people have a tendency to speed up for the "easy bits", without realising. Or they speed up for the "boring bits", to get to the "interesting bits" sooner. Some people keep a steady tempo most of the time, but slow down for "fiddly bits" without noticing. This is harder to fix, because it's possible that you're just not capable (yet) of playing the fiddly bit at full tempo.
Find out - perhaps by recording yourself - where you tend to drift off tempo, and concentrate on tempo at those times.
If there are parts that are too fiddly to play at the desired tempo, set a metronome to a slower tempo, practice just the problem section until you're good at it, then gradually increase the metronome tempo until you nail it at full speed.
One useful practice technique uses a metronome. You may need an electronic metronome, because this relies on the metronome being able to keep very slow tempos.
Start by setting the metronome to 120 ticks per minute. Play along to this until you're comfortable with the rhythm. This is the time to get comfortable with the technique of the piece you are playing -- make sure you can fit the finger movements into the available time.
Now set the metronome to half the tempo - 60 ticks per minute. Continue practising at the same tempo - but hearing ticks only on beats 1 and 3 or each bar (assuming 4/4 time signature).
Then halve the metronome tempo again, to 30 ticks per minute. Keep practising, now with a tick only on the first beat of every bar. By this point, you're supplying a lot of the rhythm yourself. When you get it right, you're rewarded by hearing the tick come when you expect it. When you get it wrong, you'll hear the tick before or after you expect it.
Keep halving the metronome tempo, and see how sparse the ticks can be, while you still synchronise with them. A tick every 4 bars should be achievable. Every 8 bars is ambitious but worth trying.
Here's a video of bassist Victor Wooten doing exactly that exercise.
I have always found the input on ultimateguitar quite useful. It's simple and straightforward, but useful nonetheless.
(The third section is quite irrelevant for solo play.)
I guess that you'll never be exactly stable but you can be more precise with practice. If your problem is getting good records, you can record your instrument and then "stretch" the track to resolve tempo problems.
A little bit of rubato isn't necessarily a bad thing, playing with time is one way to make it music (rather than computer programming). With that said, there are times when it is completely inappropriate. The most obvious is when there is an ostinato figure going on under the melody and counterpoint (if any). For example, think about Granados Villanesca, the fourth movement of his Spanish Dances. The tempo needs to be rock steady in the outer sessions (when there is an ostinato figure going in the left hand), but the inner section (Canto y Estrellita, Song and Chorus) can (and should be) rather rubato. Or for another example, think about Tchaikovsky's Romeo and Juliet Fantasy Overture, in the recap of the big love theme. The horns have an ostinato figure under the winds/strings melody. So many conductors try to ham that section up, and it just doesn't work for me. How can you play repeated offbeats when you've no idea where the beat is going to be?
With all that said, I like to use a metronome set up to give me the first beat of each phrase in a rubato section, or sometimes the last (weak) beat of the phrase and first beat of the new phrase. I'm free to play with time within those limits -- I've got to get to the cadence on time. The only times I use a metronome in literature practice are when I'm trying to get a technical passage up to speed and in a passage that has to be rock-steady. Etudes (and especially rhythmic studies) are a different matter.