I have a query which takes too long to return result set. After then I turn result set into xls format to be downloaded at same time.

Problem: Obviously, browser says "Request time out". Users will have this problem and my site will fail completely.

What else out there for me to accomplish such thing?

Thanks in advance.

You can try
ini_set('max_execution_time', 0);
at the top of your script. 0 = forever.
and just a thought...
Depending on your query and what type of data you are pulling, can you precompile some of the xml data that you want? As in, run the queries and store the data, and then a user can just request said data.