The easiest way that Congress can restrain the President in the area of foreign policy is by withholding funding. Congress has the "power of the purse", that is, they have the nation's checkbook, and any foreign war or foreign aid has to be paid for by a willing Congress. For example, if Congress decided the time had come to get the United States out of both Afghanistan and Iraq, all they would need to do is withhold the money needed to send more troops or to buy the material necessary to fight the war unless it was used directly to bring the troops home.
It's unlikely Congress would do this to troops already in the field, but at the beginning of a conflict, they can essentially stop it before it starts in this manner.
It would depend on the specific issue, but there are ways that Congress can restrain the President in foreign policy issues. One very effective way would be to simply refuse to fund the policy, at least if it has the potential to be expensive. Congress would hesitate to do this, however, as Congress runs the risk of being blamed for the policy's failure.
If the president's policy could be interpreted by Congress as "a high crime or misdemeanor," Congress could begin impeachment procedures. Two presidents have been impeached (Andrew Johnson and Bill Clinton) although neither was convicted and removed.
Any foreign policy program that required an action from Congress in the form of a bill could also be killed in Congressional committees and subcommittees. It may never get to the Congressional floor for voting.
However, in at least one important foreign policy area - the extension of diplomatic recognition to a foreign country - Congress plays no role. That is at the sole descretion of the president.