My wife was driving our 95 RHD EJ22 Legacy and the engine shut off. She coasted off the road and it started right up and worked fine. Then a couple days later it did the same thing. After checking everything I could think of, I found a post here that said to check the knock sensor. The housing was cracked. NO codes, but it shut the engine off. Replaced it and no more problems.
I would check the timing. I've read other posts here that with one tooth off it ran ok, but did not have the power it should.