I am creating a site template in Sharepoint. I also have some custom .aspx page, that I want to deploy in Layouts\myDirectory. Using my site template I will create a Web (SPWeb) that should use the custom pages and reference them by an url of the form http://site/MyWeb/MyCustomPage.aspx. How do I integrate the pages in my custom template?
A site template can only contain the contents of a single site/web. So you can't deploy files to the layouts folder using this technique.
However you can use site templates in combination with a solution package that copies your files. There is an example here. Deployment of the solution package will deploy your custom .aspx pages once. From then on they will be accessible to sites created by your site template.
Pages stored in the Layouts folder are Application Pages and should always only be referenced through the _layouts virtual directory
If you want to reference the page as http://site/MyWeb/MyCustomPage.aspx then it should be a Site Page
A site page can be put inside a feature or directly inside a Site Definition (even thought I recommend that you only use the Site Definition to activate features). The way you provision the page is throught the Module & File elements see MSDN