First off, it's perfect to say 你弹吉他多长时间了?
"时间" means "time". So it's equivalent to say "How much time have you played guitar?"
久 means long. So the perfect translation of "...how long..." is actually "...多久..."
"...how much time..." is "...多长时间..."
Just like in English, you can also ask "how many years have you been playing guitar." (你弹吉他多少年了?)
Note that you used "have been playing guitar" which is the present perfect continuous tense. For perfect translation, you need to add some words in it. But Chinese speaking in daily life is not that strict. People will understand it. If you want the detail about the tense compatible with English, that's whole another story.