Should just need to replace the gasket unless the cover is deformed. The gasket kit should include o-rings that go around the spark plug holes.
My guess is that the cam sensor issue is causing the dying concern. I'd get that addressed and see if that has any affect on the slipping. If not then you may have a seperate transmission issue.
About the only thing I would look for while you have the top of the engine disassembeld, would be to check for any sludge in the cylinder head, and clean the carbon out of the intake manifold while it's off. These motors are very solid, so there really isn't much to concern yourself with.
Here is a link to the FSM for your car. Info about the cam sensor should be in section EC. Engine info can be found in section EM.
http://www.nicoclub.com/FSM/i35/2002/
(if you have problems accessing any info in there, go to the parent directory and look at the one for the 2002 Maxima, since all the mechicals are the same.)