87 Honda trx250

Hi. I recently replaced my CDI and coil on my trx250. I can ride it as much as I want in 1st or 2nd gear, but when I hit 3rd or 4th gear, it runs for about a minute and then acts like it’s getting too much gas or not enough and it dies. It will start back up after a few minutes, but again I am not able to go above 2nd gear. Any ideas?