More Immigrants, Less Terrorism
It seems to me, though, that if one's main concern is that lax border security is going to allow terrorists to sneak in, an argument can be made that one should support a big expansion of legal immigration. I'll assume arguendo that there is some non-trivial risk that terrorists will sneak over the border -- though in fact all of the terrorist incidents that I am aware of in the U.S. were committed by either citizens or people with papers.
The argument for increased immigration to fight terrorism begins with two premises: 1) anyone who has a convenient, legal avenue to enter the country will pursue that route rather than taking the expense and risk of sneaking across the border and remaining in the U.S. without papers, and 2) there is a very large population of people in other countries whose motivation to enter the U.S. is so strong that only the harshest border security (along the lines of that between China and North Korea, as Bill O'Reilly once pointed out) could stop them.
The combination of high motivation and a lack of legal immigration routes has led to the emergence of a huge human smuggling industry. To get across the border successfully (especially if you're coming by sea or air rather than land) usually requires the services of a coyote or other trafficker. There is thus a large population of experienced people that could be hired by terrorists just as easily as tomato-pickers.
Increasing legal immigration would deprive the coyotes of their customer base, making them go out of business. In addition to all of the direct benefits of keeping people out of the hands of the coyotes (who are prone to financial exploitation, abandonment, physical and sexual abuse, and various other crimes against their charges), this would greatly reduce the availability of human smuggling services to terrorists.
What's more, the resulting great drop in undocumented border-crossing would free up Border Patrol resources to bust the remaining smugglers who are trying to bring in contraband goods such as drugs (obviously scaling back the "war on drugs" boondoggle and/or refocusing efforts away from supply disruption would have similar effects). It would also free up resources to do a more accurate job of vetting visa applicants to screen out terrorists -- since, after all, the 9/11 hijackers all came in with papers.