There are many causes for GERD ~ you should make sure that you have make all of the lifestyle changes that are warranted to aid with your circumstances. If you are not having any ill effects from the
Prilosec then you can take it for prolonged periods - keep in mind that you should consult your Pharmacist or Doctor for potential interactions with other medications.
You did not give a lot of information about your condition but be aware that there are many causes for GI distress and that you may need some other care to resolve your problem. Ulcers are often caused by over the counter pain relief medications or a bacteria called H Pilori - either of these will not resolve solely with the use of prilosec.
If you have not seen a doctor you should - you can only self-treat safely by FDA guidelines for a short time. The overuse of otc medications for GI issues can often mask more serious problems if you do not seek adequate care.