There was no way, however; my mind was still wide awake.
I always see however after semicolons but never like the case above.
Is the example grammatically correct?
It depends on the context. If this sentence were preceded by; "I sought desperately to sleep despite my acid high." The sentence would make perfect grammatical and contextual sense.
Semicolons can be used like a list separator; separating bonding statements.
Regarding semicolon statements: they can nearly always work as separate sentences in themselves; they assist the reader by inferring there is a 'bond'.
I had to get some sleep; I had work early the next day; there was no way, however; my mind was still wide awake.
Like many adverbs, 'however' can fall in different places in a clause. The semicolon in your example could just as well be a period:
There was no way, however. My mind was still awake
This could perfectly well be:
However, there was no way. My mind was still awake
There was, however, no way. My mind was still awake. and even:
There, however, was no way... although this last one would be very uncommon.
This doesn't always work for all adverbs, but it could work the same for, e.g., "honestly" or "sometimes".
So the answer to your dilemma is that the semicolon doesn't dictate where 'however' should be placed; rather, it is necessary between the clauses "There was no way" and "My mind was still awake", whether you use 'however' or not!