if visa expires before otp, can i stay in us?

my visa is expiring in may, i have otp till october. i’m i permitted to stay in us? can i go to other country before my visa expires.? am i permitted to enter into us back? if i had a job.

I am assuming you mean to say OPT and not OTP… Visa expiration has nothing to do with status, it is only to re-enter US. Once you are in US, you will need to maintain your status, as long as you are doing that, you are fine. Read US visa vs Status - Visa Expired ?