This is surprisingly tricky as it’s one of those things that usually expressed idiomatically. If you wanted to express the sentiment of “live long and prosper” in Latin you would actually say something like “ad multos annos”.
Your phrase “longevus et prosperabitur” literally means “a long life and he will prosper” – which may be fine as an idiom (taking the "have a ..." as implicitly understood), but isn’t a literal translation. “prospero” is a bit of a clunky verb to use as it means “to be made to prosper” rather than “to prosper”. To use it as you wish means that you have to use it in its passive form. So you would probably tend to say something like “may you have good fortune” in Latin – “habeas felicitate” or something like that, using the subjunctive for “habeas”.
If you remember the coronation acclamation “vivat regina”, this means “may the queen live” using the subjunctive mood (which is used to express a wish or an uncertain future). In a phrase like this, the “for many years” is taken for granted as implied by the subjunctive. In this form you might try “vivas (diu) et prosperaris” - "may you live long and prosper". Better still, “vivas (diu) et habeas felicitate” - "may you live long and have prosperity". Even "habeas longevus et felcitate" would work - "may you have have a long life and prosperity".
“vive diu et prosperere” is very clunky literal Latin for “live long and prosper” in the imperative mood; it has the sense of something of an order. You might say this to a child; you might say it at a drunken party!