Unfortunately, I have to take a guess here on what machine you have. Based on the age of the question, I am going to assume you have a 2007-2008 era machine with the 8600M GT GPU. I had the 17" 2007 and it kept failing, so Apple had to replace it. The final diagnosis was a bad GPU.
The problem with these machines is the GPU's are known to fail in them because of a factory chip defect of the nVidia supplied parts. Some machines didn't fail early, but most of them did. The problem now is the early survivors are ticking time bombs with troublesome graphics cards that are statistically more likely to fail then they were when the machines were still somewhat relevant. Back in 2007, Apple recalled these machines and offered a repair extension, which you can read about here.
The problem now is that these machines are old enough Apple no longer supports or repairs these computers anywhere (including California). What this essentially means is once the machine fails, you're on your own.
Since these machines are so old, finding a board that has never been repaired (reflowed or reballed) is next to impossible. These boards should be avoided, since these repairs only patch the problem and don't offer a permanent fix. The problem will always come back and you will be at square one again and have to keep fixing the machine when the GPU keeps failing. At this point, move the hard drive to another Mac that supports the version of OS X yours ran when it failed and copy your data to an external hard drive and replace it with a new Mac.