I've had the best luck growing cilantro in an area that gets a little bit (not a lot) of shade. Cilantro does tend to bolt (go to seed) very quickly. For this reason, I never bother buying the actual plants because I find that they just don't last very long. I think you are better off growing it from seed--look for packets that say they are the slow-bolting variety.
From your description, it sounds to me like you are either overwatering or underwatering it; the symptoms can be very similar, but since you describe the plant you bought as wilted, my guess is that it is underwatered. Leaves turning yellow or brown is probably overwatering. Watering plants in a pot is tricky. If it is hot out, plants in a pot generally require quite a bit more water than plants in the ground. You may need to water more than once a day, especially if the plants are in a terra cotta pot. I would try again with the seeds, maybe try putting the pot somewhere that gets mostly but not completely full sun. Too much sun causes bolting (although you can still eat the leaves after it has bolted, even though they do look different than the pre-bolt leaves--they'll just have a stronger flavor). Keep a close eye on the how dry you letting the soil get. If you notice the cilantro starting to wilt in the afternoon, give it some water and see if it perks up.
You could also try a self-watering container, like the
earthbox. I have one and I have to say that it has not worked at all for vegetables, but for something like herbs, that have a shallow root system, it might work better. And you definitely wouldn't have to worry about watering as much.
If your cilantro does bolt, you can save the seeds and plant them next year.
I've also kept cilantro for up to three weeks in the fridge. Try putting it in a plastic bag (ziploc or sealed with a twistie) with a damp paper towel in the bag to keep it a little moist.