999

Let the first two terms of the sequence be a and b respectively. Then the next three terms are a+b, a+2b and 2a+3b. So 2a+3b=2004. For a to be as large as possible, we need b to be as small as possible, consistent with their both being positive integers. If b=1 then 2a=2001, but a is an integer, so b1.

However, if b=2 then 2a=1998, so the maximum possible value of a is 999.