There are several tour buses from Andalucia (we took these from Marbella) to Gibraltar which are very comfortable and reasonable (I can't remember exact cost but I think around 40 Euros per person). They give you 4-5 hours in Gibraltar which is plenty to see the apes, do some shopping and grab a quick lunch.
We took this trip twice, both times from Marriott in Marbella.